Answers for "nodejs api to logged in users count on an application"

0

nodejs api to logged in users count on an application

var io = require('socket.io').listen(8080);
var count = 0

io.sockets.on('connection', function(socket) {
    count++;
    io.sockets.emit('message', { count: count });

    socket.on('disconnect', function(){
        count--;
        io.sockets.emit('message', { count: count });
    })
});
Posted by: Guest on November-24-2020

Code answers related to "nodejs api to logged in users count on an application"

Code answers related to "Javascript"

Browse Popular Code Answers by Language