Count of connected clients/sockets
See original GitHub issueHi,
I am using io.sockets.clients().length
to get the count of all currently connected clients, but after some time this number is way to high, many disconnected clients are still present in this array.
Below an image of io.sockets.clients().length
, plotted every 5 minutes for 24 hours. Once the count reached over ~2k, i restarted the server, about 200 to 300 clients reconnected, which is the correct count.
Is this the wrong way to get the count of all connected clients? I also tried to count the connects and disconnects manually, but after one day there were more disconnects than connects, the count was negative.
Issue Analytics
- State:
- Created 12 years ago
- Comments:53 (4 by maintainers)
Top Results From Across the Web
Socket.IO Connected User Count - node.js - Stack Overflow
This returns the number of clients connected to my server. The problem is after a few connects and disconnects of users, the number...
Read more >The Server instance - Socket.IO
A reference to the underlying Engine.IO server. It can be used to fetch the number of currently connected clients: const count = io.engine....
Read more >Detecting the Number of Connected Socket Users - Medium
Detecting the Number of Connected Socket Users. This post assumes that you have basic knowledge of React and Socket.io, their basic setups, uses ......
Read more >socket.io.clientsCount JavaScript and Node.js code examples
Best JavaScript code snippets using socket.io.clientsCount(Showing top 6 results out of 315) ; console.log('User ' + client.id + ; io.emit("update-users", io.
Read more >Scaling Socket.IO - practical considerations - Ably Realtime
As we saw in the performance section of this article, a Socket.IO server can sustain 10,000 concurrent connections. However, this number is only ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
there is also a Disable notifications for this Issue below
man i got to do it +1 to that