diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-02-25 14:09:51 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-03-01 21:17:48 +0100 |
commit | dc069da5447f5856b59b5f1885f0eeb304abb670 (patch) | |
tree | cedd5ab69c31c0f13b98caef0b6414c12d0427ba | |
parent | fab1401922290364fcd260d7390701b46aa3eb75 (diff) | |
download | server-dc069da5447f5856b59b5f1885f0eeb304abb670.tar.gz |
Send presence as an array instead of an object!
-rw-r--r-- | server.js | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -2222,9 +2222,10 @@ function on_restore(socket, state_text) { } function broadcast_presence(game_id) { - let presence = {} + let presence = [] for (let socket of game_clients[game_id]) - presence[socket.role] = true + if (!presence.includes(socket.role)) + presence.push(socket.role) for (let socket of game_clients[game_id]) send_message(socket, 'presence', presence) } |