faye/faye-websocket-node

Close before the upgrade request is handled by the server

Closed this issue · 6 comments

The server does not close cleanly if the client closes before the upgrade request is handled.
In this gist you can find a test case to reproduce the issue.
The close event is never emitted on the server and the process never exits.

The same example "works" when using einaros/ws and it seems that the edge case is handled here.

Thank you.

Thanks for spotting this; it's fixed in 29d07c5.

Awesome, thank you!
Can you release the fix on npm when you have time?

@jcoglan i was testing this and i noticed that the process exits, but the close event is not fired on the server. The close listener is never called.

Surely that's down to Node? faye-websocket doesn't control which events the HttpServer emits.

@jcoglan I was thinking the same, wondering if it is an issue of the http.Server or it is intended.

I've created this issue nodejs/node-v0.x-archive#8763.
The problem seems to be caused by the fact that the stream is still writable on the server when the socket is destroyed. I still don't know why the process exits.