From: Ruben Beltran del Rio Date: Wed, 30 Aug 2023 16:15:45 +0000 (+0000) Subject: Use room all around X-Git-Url: https://git.r.bdr.sh/rbdr/junction/commitdiff_plain/8a872a93634a516782d05934188ba2db3849fec9 Use room all around --- diff --git a/server/index.js b/server/index.js index e6a37c7..6493ba4 100644 --- a/server/index.js +++ b/server/index.js @@ -17,19 +17,19 @@ server.on('connection', (socket) => { socket.join(room); if (!rooms[room]) { - rooms[room] = {}; + rooms[room] = []; } rooms[room].push(socket.id); - const sockets = await server.in(data.url).fetchSockets() + const sockets = await server.in(room).fetchSockets() sockets.forEach((peer) => { if (peer.id !== me) { peer.emit(events.types.ADD_PEER, events.addPeer(me, false)); socket.emit(events.types.ADD_PEER, events.addPeer(peer.id, true)); } }); - console.log(`[CONNECT] Client ${me} added to room ${data.url}`); + console.log(`[CONNECT] Client ${me} added to room ${room}`); }); socket.on('disconnecting', () => {