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

How long is a disconnected client kept in io.sockets.clients() #349

Closed
bigal488 opened this issue Jul 6, 2011 · 3 comments
Closed

How long is a disconnected client kept in io.sockets.clients() #349

bigal488 opened this issue Jul 6, 2011 · 3 comments
Labels
bug Something isn't working

Comments

@bigal488
Copy link

bigal488 commented Jul 6, 2011

using 0.7.6 from npm. When a client connects and then the browser is quit (i.e. the client doesnt send a disconnect event), the client seems to remain listed in io.sockets.clients() with a status of disconnected=true indefinitely.
Surely clients should be auto-pruned after a configurable timeout? - I couldnt find anything on the Wiki

@3rd-Eden
Copy link
Contributor

There is a close timeout option after 25 min they should be deleted see: https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO

But they should not stay in memory after that. Also, the clients() should probably not return clients that have been disconnected.

@3rd-Eden 3rd-Eden reopened this Jul 27, 2011
@bigal488
Copy link
Author

Thanks ...but the docs on https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO, say 25 seconds rather than minutes.
Also,
If I run the following code:

for(var client in io.sockets.clients()) {
            console.log(io.sockets.clients()[client].id + ' disconnected: ' + io.sockets.clients()[client].disconnected)
}

I have disconnected clients that are still listed after 24 hours(!).
Output is

1778893739744485800 disconnected: true
853765464549814556 disconnected: true
309269981192324236 disconnected: true
13907553021827206504 disconnected: true
14834125302031387742 disconnected: true
25859936737387299 disconnected: true
762226140562305048 disconnected: true
2124697256848022665 disconnected: true
863853335251078342 disconnected: true
981231391902650345 disconnected: true
2076003476655548035 disconnected: true
7476129201553153060 disconnected: true
1676489844425733110 disconnected: true
3443544511569537319 disconnected: true

@3rd-Eden
Copy link
Contributor

Whoops, that was a small typo on my side. But thanks for the report, I labeled it as performance issue. As they really should have been cleared.

But it could be that I already fixed it in master, as I did allot memory clean up fixes a few days ago. But this definitely something that we need to test and add to our test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants