Commit 47103550 authored by 18신대성's avatar 18신대성 Committed by 16이지혜

disconnect 구현

parent fc2d177d
...@@ -47,4 +47,17 @@ io.on('connection', function(socket) ...@@ -47,4 +47,17 @@ io.on('connection', function(socket)
}); });
}); });
socket.on('disconnect', function(reason)
{
var idxToDel = GameServer.waitingRoom.findIndex( function(element)
{
return element.socketId == socket;
}
);
if (idxToDel != -1)
{
console.log('client disconnected, id: ' + GameServer.waitingRoom[idxToDel].id + ', reason: ' + reason);
GameServer.waitingRoom.splice(idxToDel, 1);
}
});
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment