added in socket.id logic for messages and disconnect.
This commit is contained in:
parent
d1ad87cd6d
commit
7c49aa21a3
1 changed files with 7 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue