Closed rosesandhello closed 8 years ago
From what I can tell, the close code is not recognized by the websocket spect. From MDN:
1006 CLOSE_ABNORMAL Reserved. Used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected.
That explains why your app is crashing when 1006 is received. I can't explain why your app is receiving it in the first place. It is most likely a bug in the other side.
That's correct. According to the Websocket Spec (RFC 6455, Section 7.4.1):
1006 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting a status code to indicate that the connection was closed abnormally, e.g., without sending or receiving a Close control frame.
That error is not thrown when you are receiving a close reason code of 1006, but rather when you are trying to send a close reason code of 1006, which is not allowed. Line 422 of WebSocketConnection.js is inside the close
method, which is invoked by your code, not as part of handling a close frame from the remote peer.
websocket appears to crash on receiving a close reason code of 1006:
Error: Close code 1006 is not valid. at WebSocketConnection.close (/---/node_modules/websocket/lib/WebSocketConnection.js:422:19) at WebSocketConnection.<anonymous> (/---.js:597:41) at emitTwo (events.js:92:20) at WebSocketConnection.emit (events.js:172:7) at WebSocketConnection.drop (/---/node_modules/websocket/lib/WebSocketConnection.js:468:14) at WebSocketConnection.handleGracePeriodTimer (/---/node_modules/websocket/lib/WebSocketConnection.js:257:10) at Timer.listOnTimeout (timers.js:89:15)
Any insight would be greatly appreciated.