Answer the question
In order to leave comments, you need to log in
Number of connections to socket.io?
How do you count connections to socket.io?
Tried like this: Object.keys(io.sockets.connected).length
And like this: io.sockets.sockets.length
And also like this:
var count = 0;
io.on('connection', function(socket) {
console.log(++count);
socket.on('disconnect', function() {
console.log(--count);
});
});
Answer the question
In order to leave comments, you need to log in
Something one subscription to the topic, no answers, no one knows how to solve this problem?
There is an idea to look at the minimum data exchange through sockets and navigate according to this data, but maybe there are much more profitable solutions?
Maybe this solution will work:
https://coderwall.com/p/ekrcyw/socket-io-managing-...
Writing to the session or database, and when disconnecting, delete the required sid accordingly
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question