diff --git a/lib/socketServer.js b/lib/socketServer.js index e9f649b..644e6a4 100644 --- a/lib/socketServer.js +++ b/lib/socketServer.js @@ -39,6 +39,7 @@ function emit(socket, type, data){ }; function broadcast(type,data){ + this.log(arguments) this.log('broadcasting event to all known sockets listening to '.debug, this.path.variable,' : ', ((this.port)?this.port:''), type, data); if(!data) data=false; @@ -186,8 +187,6 @@ function init(path,config,log,port){ var e=JSON.parse(data.shift()); server.log('received event of : '.debug,e.type.data,e.data); - server.sockets.push(sock); - server.trigger( e.type, e.data, @@ -308,7 +307,8 @@ function init(path,config,log,port){ continue; } - server.log('Socket disconnected'.notice); + server.log(socket.id, 'socket disconnected'.notice); + var deadSocket=socket.id; if(socket) socket.destroy(); @@ -316,7 +316,10 @@ function init(path,config,log,port){ server.sockets.splice(i,1); server.trigger( - 'socket.disconnected' + 'socket.disconnected', + { + id:deadSocket + } ); return;