You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// NOTE: We don't have the WebSocketConnection instance yet so no
// way to close the TCP connection.
// Artificially invoke the onConnectFailed event.
onConnectFailed.call(this);
// And close if it connects after a while.
this._client.on('connect',function(connection){
if(code){
connection.close(code,reason);
}else{
connection.close();
}
});
break;
Essentially, if we have connection in connection.readyState === CONNECTING, we are waiting for connection to be established, but this will not happen if server is dead for instance.
I had to do this dirty workaround to handle this situation, but I believe something similar should be done in the library itself:
connection._client._req.socket.destroy()
The text was updated successfully, but these errors were encountered:
I have an issue with graceful connections closing, under certain circumstances connection is not closed properly.
I blame this code:
WebSocket-Node/lib/W3CWebSocket.js
Lines 138 to 151 in 7db960e
Essentially, if we have connection in
connection.readyState === CONNECTING
, we are waiting for connection to be established, but this will not happen if server is dead for instance.I had to do this dirty workaround to handle this situation, but I believe something similar should be done in the library itself:
The text was updated successfully, but these errors were encountered: