Comparing version 0.8.0 to 0.8.1
@@ -72,2 +72,19 @@ | ||
/** | ||
* Releases all resources used by the extension | ||
* | ||
* @api public | ||
*/ | ||
PerMessageDeflate.prototype.cleanup = function() { | ||
if (this._inflate) { | ||
this._inflate.close(); | ||
this._inflate = null; | ||
} | ||
if (this._deflate) { | ||
this._deflate.close(); | ||
this._deflate = null; | ||
} | ||
}; | ||
/** | ||
* Accept extension offer from client | ||
@@ -235,5 +252,7 @@ * | ||
function cleanup() { | ||
if (!self._inflate) return; | ||
self._inflate.removeListener('error', onError); | ||
self._inflate.removeListener('data', onData); | ||
if (fin && self.params[endpoint + '_no_context_takeover']) { | ||
self._inflate.close(); | ||
self._inflate = null; | ||
@@ -286,5 +305,7 @@ } | ||
function cleanup() { | ||
if (!self._deflate) return; | ||
self._deflate.removeListener('error', onError); | ||
self._deflate.removeListener('data', onData); | ||
if (fin && self.params[endpoint + '_no_context_takeover']) { | ||
self._deflate.close(); | ||
self._deflate = null; | ||
@@ -291,0 +312,0 @@ } |
@@ -248,3 +248,3 @@ /*! | ||
if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true); | ||
else if (this.state.lastFragment) this.fragmentedBufferPool.reset(false); | ||
else if (this.state.lastFragment) this.fragmentedBufferPool.reset(true); | ||
this.expectOffset = 0; | ||
@@ -251,0 +251,0 @@ this.expectBuffer = null; |
@@ -48,3 +48,3 @@ 'use strict'; | ||
if (this instanceof WebSocket === false) { | ||
throw new TypeError("Classes can't be function-called"); | ||
return new WebSocket(address, protocols, options); | ||
} | ||
@@ -956,2 +956,8 @@ | ||
if (this.extensions[PerMessageDeflate.extensionName]) { | ||
this.extensions[PerMessageDeflate.extensionName].cleanup(); | ||
} | ||
this.extensions = null; | ||
this.removeAllListeners(); | ||
@@ -958,0 +964,0 @@ this.on('error', function onerror() {}); // catch all errors after this |
@@ -24,3 +24,3 @@ /*! | ||
if (this instanceof WebSocketServer === false) { | ||
throw new TypeError("Classes can't be function-called"); | ||
return new WebSocketServer(options, callback); | ||
} | ||
@@ -111,3 +111,3 @@ | ||
WebSocketServer.prototype.close = function() { | ||
WebSocketServer.prototype.close = function(callback) { | ||
// terminate all associated clients | ||
@@ -141,3 +141,6 @@ var error = null; | ||
} | ||
if (error) throw error; | ||
if(callback) | ||
callback(error); | ||
else if(error) | ||
throw error; | ||
} | ||
@@ -144,0 +147,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.8.0", | ||
"version": "0.8.1", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
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
102190
3012