SIGN IN SIGN UP
socketio / socket.io UNCLAIMED

Realtime application framework (Node.JS server)

0 0 0 TypeScript

fix: properly close the websocket connection upon handshake error

This should fix the following error:

> TypeError: Cannot read property 'writeHead' of undefined

This bug was introduced by [1], because the `if (res !== undefined) { ... }`
check was removed.

But `res` is indeed undefined when the client connects with WebSocket
directly, in that case we need to manually write the response content
(in the abortUpgrade method).

Please note that the previous behavior was invalid too, since the
WebSocket connection was left open when an error occurred during the
handshake.

[1]: https://github.com/socketio/engine.io/commit/7096e98a02295a62c8ea2aa56461d4875887092d
D
Damien Arrachequesne committed
43606865e5299747cbb31f3ed9baf4567502a879
Parent: 29bd4fe