server cleaning
This commit is contained in:
parent
b4b3e4142e
commit
4ab6f5da50
1 changed files with 1 additions and 12 deletions
|
@ -161,18 +161,7 @@ wss.on('connection', (socket, req) => {
|
||||||
|
|
||||||
//handle disconnecting
|
//handle disconnecting
|
||||||
socket.on('close', () => {
|
socket.on('close', () => {
|
||||||
for (var i = players.length - 1; i >= 0; i--) {
|
deletePlayer(socket);
|
||||||
broadcast(JSON.stringify({
|
|
||||||
type: "removePlayer",
|
|
||||||
data: {
|
|
||||||
id: socket.id
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
if (players[i].id == socket.id) {
|
|
||||||
players.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
connections.delete(socket);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue