[feature]: Added spectating #2

Manually merged
arne merged 1 commits from corner/TanksJS-Server:master into master 2020-11-08 19:35:26 +01:00
2 changed files with 3050 additions and 1 deletions
Showing only changes of commit c97714cb75 - Show all commits

3044
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -129,6 +129,13 @@ io.on("connection", (socket) => {
}); });
} }
}); });
socket.on("spectate", (data) => {
if (io.sockets.adapter.rooms.has(data)) {
console.log(traffic.in + colours.connect(`User ${String(socket.id)} is spectating room ${data}`));
socket.join(data);
}
});
}); });
http.listen(port, () => { http.listen(port, () => {