[Pkg-javascript-commits] [sockjs-client] 348/350: Do not pass protocols or options to browser WebSocket constructor
tonnerre at ancient-solutions.com
tonnerre at ancient-solutions.com
Fri Aug 5 01:04:37 UTC 2016
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.
commit 94a1bec613a6cb47c45c00c815895369e3f0ee77
Author: Bryce Kahle <bkahle at gmail.com>
Date: Fri May 20 11:22:04 2016 -0700
Do not pass protocols or options to browser WebSocket constructor
Fixes #309
---
lib/transport/browser/websocket.js | 9 ++++++++-
lib/transport/websocket.js | 2 +-
tests/node.js | 6 +++++-
tests/support/sockjs_server.js | 2 ++
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/lib/transport/browser/websocket.js b/lib/transport/browser/websocket.js
index b98b3b9..dbd3bfd 100644
--- a/lib/transport/browser/websocket.js
+++ b/lib/transport/browser/websocket.js
@@ -1 +1,8 @@
-module.exports = global.WebSocket || global.MozWebSocket;
+'use strict';
+
+var Driver = global.WebSocket || global.MozWebSocket;
+if (Driver) {
+ module.exports = function WebSocketBrowserDriver(url) {
+ return new Driver(url);
+ };
+}
diff --git a/lib/transport/websocket.js b/lib/transport/websocket.js
index 55d5d5b..7f5ce3e 100644
--- a/lib/transport/websocket.js
+++ b/lib/transport/websocket.js
@@ -29,7 +29,7 @@ function WebSocketTransport(transUrl, ignore, options) {
}
this.url = url;
- this.ws = new WebsocketDriver(this.url, undefined, options);
+ this.ws = new WebsocketDriver(this.url, [], options);
this.ws.onmessage = function(e) {
debug('message event', e.data);
self.emit('message', e.data);
diff --git a/tests/node.js b/tests/node.js
index 4c2d787..0f2b0af 100644
--- a/tests/node.js
+++ b/tests/node.js
@@ -1,6 +1,6 @@
'use strict';
-require('./support/sockjs_server');
+var server = require('./support/sockjs_server');
require('./lib/main');
require('./lib/main-node');
@@ -9,3 +9,7 @@ require('./lib/receivers');
require('./lib/senders');
require('./lib/end-to-end');
require('./lib/transports');
+
+after(function() {
+ server.close();
+});
diff --git a/tests/support/sockjs_server.js b/tests/support/sockjs_server.js
index 7749860..9d5a079 100644
--- a/tests/support/sockjs_server.js
+++ b/tests/support/sockjs_server.js
@@ -74,3 +74,5 @@ sockjs.install({
console.log(' [*] Listening on', port);
server.listen(port);
+
+module.exports = server;
--
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