-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onclose not called if a client disconnects due to network failure #686
Comments
https://github.com/FlorianBELLAZOUZ/ws/tree/KeepAlive This provides an implementation for the above issue |
@pavan4 I have the same issue, your implementation is quite good... I suggest developers to merge in master... 👍 |
@urosjarc The implementation I mentioned above does this out of the box for you with pings but it doesnt work on ubuntu 14.0.4 and the timeout on tcp defaults to 30s always. Pings to the client result in error and are crashing the server, I am not able to rely on the pings. |
Then what are your suggestions? I know only pings checking if connection is alive... |
I am planning to use https://github.com/theturtle32/WebSocket-Node This package has similar performance as ws and provides a onclose notification when the client disconnects |
Did you check onclose method for network drop, does it really emit? |
I've got the same problem with detecting connections experiencing network errors. I've tried setting keepAlive, as pointed here, but
|
@r-pr how has the above ping/pong code worked out for you? Have you used it in production and if so how many connections? Thanks! |
This is my implementation: |
I will add additional docs if there will be an interest in this lib. |
@john-doherty It seems that the mechanism does the job, but I haven't used it in production. |
@r-pr I'm going to use a slightly modified version of your concept. I'll let you know how it goes. |
has the issue been solved in the latest version? |
A possible way to handle this issue is illustrated here: https://github.com/websockets/ws#how-to-detect-and-close-broken-connections. |
I am listening to the close event from a client on a node server using
websocket.on('close', function close() { } );
However, the callback is not being fired if a client gets disconnected due to network failure.
Is there any way to detect dead connections on the server side ?
The text was updated successfully, but these errors were encountered: