Compare commits
2 Commits
3537634d17
...
3e5296ac25
Author | SHA1 | Date | |
---|---|---|---|
3e5296ac25 | |||
8112a65204 |
@ -32,7 +32,7 @@ wss.on("connection", (ws, req) => {
|
||||
color: [Math.floor(Math.random()*255),Math.floor(Math.random()*255),Math.floor(Math.random()*255)]
|
||||
}
|
||||
let t = Array.from(wss.clients).map(ws => ws.user.id);
|
||||
for (let i = 0; i < 256; i++) if (!t.includes(i)) { ws.user = i; break; }
|
||||
for (let i = 0; i < 256; i++) if (!t.includes(i)) { ws.user.id = i; break; }
|
||||
if (!ws.user.id) return ws.close();
|
||||
|
||||
console.log("join", ws.user);
|
||||
|
Loading…
Reference in New Issue
Block a user