Comparing version 0.6.3 to 0.6.4
@@ -0,1 +1,8 @@ | ||
v0.6.4 - December 28th 2014 | ||
===================== | ||
* Various of documentation improvements from [garcg] and [formula1] | ||
* Support for sub protocol as array [garcg] | ||
* Fixed for closing handshake which leads to dataloss when using deflate [nkzawa] | ||
v0.6.3 - December 8th 2014 | ||
@@ -2,0 +9,0 @@ ===================== |
@@ -604,3 +604,2 @@ /*! | ||
this.flush(); | ||
this.endPacket(); | ||
}, | ||
@@ -607,0 +606,0 @@ }, |
@@ -55,3 +55,3 @@ /*! | ||
callback(); | ||
cb(); | ||
if (typeof cb == 'function') cb(); | ||
}); | ||
@@ -58,0 +58,0 @@ this.flush(); |
@@ -63,6 +63,5 @@ 'use strict'; | ||
// TODO: actually handle the `Sub-Protocols` part of the WebSocket client | ||
this._socket = null; | ||
this._ultron = null; | ||
this._closeReceived = false; | ||
this.bytesReceived = 0; | ||
@@ -99,6 +98,3 @@ this.readyState = null; | ||
WebSocket.prototype.close = function close(code, data) { | ||
if ( | ||
this.readyState === WebSocket.CLOSING | ||
|| this.readyState === WebSocket.CLOSED | ||
) return; | ||
if (this.readyState === WebSocket.CLOSED) return; | ||
@@ -110,2 +106,9 @@ if (this.readyState === WebSocket.CONNECTING) { | ||
if (this.readyState === WebSocket.CLOSING) { | ||
if (this._closeReceived && this._isServer) { | ||
this.terminate(); | ||
} | ||
return; | ||
} | ||
var self = this; | ||
@@ -119,3 +122,10 @@ try { | ||
if (err) self.emit('error', err); | ||
self.terminate(); | ||
if (self._closeReceived && self._isServer) { | ||
self.terminate(); | ||
} else { | ||
// ensure that the connection is cleaned up even when no response of closing handshake. | ||
clearTimeout(self._closeTimer); | ||
self._closeTimer = setTimeout(cleanupWebsocketResources.bind(self, true), closeTimeout); | ||
} | ||
}); | ||
@@ -519,3 +529,3 @@ } catch (e) { | ||
headers: null, | ||
protocol: null, | ||
protocol: protocols.join(','), | ||
agent: null, | ||
@@ -751,3 +761,3 @@ | ||
function firstHandler(data) { | ||
if (self.readyState !== WebSocket.OPEN) return; | ||
if (self.readyState !== WebSocket.OPEN && self.readyState !== WebSocket.CLOSING) return; | ||
@@ -816,2 +826,3 @@ if (upgradeHead && upgradeHead.length > 0) { | ||
self._closeReceived = true; | ||
self.close(code, data); | ||
@@ -818,0 +829,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"description": "simple to use, blazing fast and thoroughly tested websocket client, server and console for node.js, up-to-date against RFC-6455", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128651
2942