1var io = require('socket.io').listen(8080);
2var count = 0
3
4io.sockets.on('connection', function(socket) {
5 count++;
6 io.sockets.emit('message', { count: count });
7
8 socket.on('disconnect', function(){
9 count--;
10 io.sockets.emit('message', { count: count });
11 })
12});
13