Permalink
Browse files

Fix #11 Cannot specify WebSocketStompMock

This var was a hack to be able to test the lib using a mock stomp web
server.
Replace it by a variable "WebSocketClass" inside the Stomp object.

To use another WebSocket implementation than the one provided by the Web
browser, you can now specify:

Stomp.WebSocketClass = SockJS;
client = Stomp.client(url)
  • Loading branch information...
jmesnil committed Jun 5, 2012
1 parent d1f6006 commit 475171878bf9de28c20a5c4d4cf4e5469b83d23f
Showing with 6 additions and 8 deletions.
  1. +4 −6 dist/stomp.js
  2. +2 −2 src/stomp.coffee
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -76,7 +76,7 @@ class Client
connect: (login_, passcode_, connectCallback, errorCallback) ->
@debug?("Opening Web Socket...")
- klass = WebSocketStompMock or WebSocket
+ klass = Stomp.WebSocketClass || WebSocket
@ws = new klass(@url)
@ws.binaryType = "arraybuffer"
@ws.onmessage = (evt) =>
@@ -156,4 +156,4 @@ if window?
window.Stomp = Stomp
else
exports.Stomp = Stomp
- WebSocketStompMock = require('./test/server.mock.js').StompServerMock
+ Stomp.WebSocketClass = require('./test/server.mock.js').StompServerMock

0 comments on commit 4751718

Please sign in to comment.