From dc069da5447f5856b59b5f1885f0eeb304abb670 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 25 Feb 2023 14:09:51 +0100 Subject: Send presence as an array instead of an object! --- server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index ecc03eb..3fad7d5 100644 --- a/server.js +++ b/server.js @@ -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) } -- cgit v1.2.3