[Pkg-javascript-commits] [sockjs-client] 36/434: New firefox has MozWebsocket object
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:00 UTC 2014
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch master
in repository sockjs-client.
commit dfb76be4df5329d9fdcbf97cd53af90239d29934
Author: Marek Majkowski <majek04 at gmail.com>
Date: Mon Aug 1 18:41:04 2011 +0100
New firefox has MozWebsocket object
---
lib/trans-websocket.js | 8 ++++++--
tests-src/test-factory.coffee | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/trans-websocket.js b/lib/trans-websocket.js
index 1364752..301a48f 100644
--- a/lib/trans-websocket.js
+++ b/lib/trans-websocket.js
@@ -8,7 +8,11 @@ var WebSocketTransport = SockJS.websocket = function(ri, trans_url) {
}
that.ri = ri;
that.url = url;
- that.ws = new WebSocket(that.url);
+ var Constructor = window.WebSocket || MozWebSocket;
+ that.ws = new Constructor(that.url);
+ that.ws.onopen = function(e) {
+ console.log('onopen');
+ };
that.ws.onmessage = function(e) {
that.ri._didMessage(e.data);
};
@@ -32,5 +36,5 @@ WebSocketTransport.prototype.doCleanup = function() {
};
WebSocketTransport.enabled = function() {
- return (typeof WebSocket === 'function');
+ return (typeof WebSocket === 'function' || MozWebSocket);
};
diff --git a/tests-src/test-factory.coffee b/tests-src/test-factory.coffee
index 3cc985d..bb6b4d9 100644
--- a/tests-src/test-factory.coffee
+++ b/tests-src/test-factory.coffee
@@ -16,7 +16,7 @@ echo_factory_factory = (protocol, messages) ->
else
r.send(a[0])
r.onclose = (e) ->
- log('a', ''+e)
+ log('onclose', ''+e)
ok(true)
start()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list