[Pkg-javascript-commits] [sockjs-client] 128/350: Fix some close codes

tonnerre at ancient-solutions.com tonnerre at ancient-solutions.com
Fri Aug 5 01:03:52 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 11ff0d96da81f50ac9831d21da3f528f0d1f7249
Author: Bryce Kahle <bkahle at gmail.com>
Date:   Mon Oct 13 11:47:50 2014 -0400

    Fix some close codes
---
 lib/main.js                  | 2 --
 lib/transport/lib/polling.js | 2 +-
 lib/transport/websocket.js   | 6 +++++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/main.js b/lib/main.js
index 9fa727b..2f3f665 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -75,8 +75,6 @@ function SockJS(url, protocols, transportsWhitelist) {
   // Step 6 - convert origin
   this._origin = loc.origin ? loc.origin.toLowerCase() : null;
 
-  // TODO do we want to allow relative urls? Spec says no
-
   // strip port numbers for 80 and 443 cases
   // Issue #74
   if (!secure && parsedUrl.port === '80') {
diff --git a/lib/transport/lib/polling.js b/lib/transport/lib/polling.js
index 86cbb2c..e1a4092 100644
--- a/lib/transport/lib/polling.js
+++ b/lib/transport/lib/polling.js
@@ -29,7 +29,7 @@ Polling.prototype._scheduleReceiver = function() {
       if (reason === 'network') {
         self._scheduleReceiver();
       } else {
-        self.emit('close', code || 1000, reason);
+        self.emit('close', code || 1006, reason);
       }
     }
   });
diff --git a/lib/transport/websocket.js b/lib/transport/websocket.js
index b49be52..d68518e 100644
--- a/lib/transport/websocket.js
+++ b/lib/transport/websocket.js
@@ -31,7 +31,11 @@ function WebSocketTransport(transUrl) {
   this.unloadRef = utils.unloadAdd(function(){
     self.ws.close();
   });
-  this.ws.onclose = this.ws.onerror = function() {
+  this.ws.onclose = function(e) {
+    self.emit('close', e.code, e.reason);
+    self.removeAllListeners();
+  };
+  this.ws.onerror = function() {
     self.emit('close', 1006, 'WebSocket connection broken');
     self.removeAllListeners();
   };

-- 
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