added in socket.id logic for messages and disconnect.

This commit is contained in:
Brandon Nozaki Miller 2014-08-27 20:57:37 -07:00
parent d1ad87cd6d
commit 7c49aa21a3

View file

@ -303,20 +303,24 @@ function init(path,config,log,port){
function(){ function(){
for(var i=0, count=server.sockets.length; i<count; i++){ for(var i=0, count=server.sockets.length; i<count; i++){
var socket=server.sockets[i]; var socket=server.sockets[i];
var destroyedSocketId=null;
if(socket){ if(socket){
if(socket.readable) if(socket.readable)
continue; continue;
} }
server.log('socket disconnected'.notice); if(socket.id)
destroyedSocketId=socket.id;
server.log('socket disconnected'.notice,' '+destroyedSocketId.variable);
if(socket) if(socket)
socket.destroy(); socket.destroy();
server.sockets.splice(i,1); server.sockets.splice(i,1);
server.trigger('socket.disconnected', socket); server.trigger('socket.disconnected', socket, destroyedSocketId);
return; return;
} }