Skip to content
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

Connections remain open despite the client no longer connected #162

Closed
JTallis opened this issue Jul 6, 2014 · 3 comments
Closed

Connections remain open despite the client no longer connected #162

JTallis opened this issue Jul 6, 2014 · 3 comments

Comments

@JTallis
Copy link

JTallis commented Jul 6, 2014

I'm using the latest NodeJS/npm versions and I have the latest modules installed.

When a client connects and disconnects, for the most part it works perfectly fine. The server is able to detect when a client has left and the close event for that connection is called. If the connection is closed via the server (for example, a user issued a kick command) then it seems to take up to about 5 seconds before it realises the client has been disconnected.

This does not always happen however. When a client disconnects abruptly, the server sometimes is not aware of it. Despite data being written to the socket which is "closed", no errors emit and the close event for that socket connection is never called. When I attempt to "kick" the client, I call "close" on the socket and due to the fact there is no client to receive the data, it is unable to respond to the close request.

The only way I can get the server to remove the connection is to either restart it or modify the code to have it "appear" disconnected to all the other clients however the latter is more of a "quick fix".

Has anyone else experienced issues where the server still thinks a client is connected and never fires the close event on that socket despite requesting to close it?

@brycekahle
Copy link
Contributor

Do you have example code to show what you are doing? Also something that reproduces the issue would be really helpful.

@brycekahle
Copy link
Contributor

This sounds similar to #159

@brycekahle
Copy link
Contributor

The 5 second delay on server .close() is #133

brycekahle added a commit that referenced this issue Oct 25, 2014
This utilizes the web socket protocol ping-pong op codes. If the
connection supports them, it will send them instead of heartbeat
frames. If the client doesn’t respond within 10 seconds, it considers
the connection closed.
brycekahle added a commit that referenced this issue May 30, 2015
#129, #162 add ws ping-pong and close if no response
@JTallis JTallis closed this as completed Dec 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants