Comparing version 7.5.0 to 7.5.1
@@ -87,9 +87,9 @@ 'use strict'; | ||
// | ||
// - If the state of the `WebSocket` connection is `CONNECTING`, | ||
// `ws.terminate()` is a noop as no socket was assigned. | ||
// - Otherwise, the error was re-emitted from the listener of the `'error'` | ||
// - If the `'error'` event is emitted before the `'open'` event, then | ||
// `ws.terminate()` is a noop as no socket is assigned. | ||
// - Otherwise, the error is re-emitted by the listener of the `'error'` | ||
// event of the `Receiver` object. The listener already closes the | ||
// connection by calling `ws.close()`. This allows a close frame to be | ||
// sent to the other peer. If `ws.terminate()` is called right after this, | ||
// the close frame might not be sent. | ||
// then the close frame might not be sent. | ||
terminateOnDestroy = false; | ||
@@ -96,0 +96,0 @@ duplex.destroy(err); |
@@ -228,3 +228,9 @@ 'use strict'; | ||
if (this.readyState === WebSocket.CLOSING) { | ||
if (this._closeFrameSent && this._closeFrameReceived) this._socket.end(); | ||
if ( | ||
this._closeFrameSent && | ||
(this._closeFrameReceived || this._receiver._writableState.errorEmitted) | ||
) { | ||
this._socket.end(); | ||
} | ||
return; | ||
@@ -242,3 +248,9 @@ } | ||
this._closeFrameSent = true; | ||
if (this._closeFrameReceived) this._socket.end(); | ||
if ( | ||
this._closeFrameReceived || | ||
this._receiver._writableState.errorEmitted | ||
) { | ||
this._socket.end(); | ||
} | ||
}); | ||
@@ -245,0 +257,0 @@ |
{ | ||
"name": "ws", | ||
"version": "7.5.0", | ||
"version": "7.5.1", | ||
"description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
115795
3320