zirosas
9/12/2014 - 12:20 AM

SocketIO Disconnected : From https://stackoverflow.com/questions/17287330/socket-io-handling-disconnect-event?answertab=votes#tab-top

var allClients = [];
io.sockets.on('connection', function(socket) {
   allClients.push(socket);

   socket.on('disconnect', function() {
      console.log('Got disconnect!');

      var i = allClients.indexOf(socket);
      delete allClients[i];
   });
});