]> git.r.bdr.sh - rbdr/junction/commitdiff
Use room all around
authorRuben Beltran del Rio <redacted>
Wed, 30 Aug 2023 16:15:45 +0000 (16:15 +0000)
committerRuben Beltran del Rio <redacted>
Wed, 30 Aug 2023 16:15:45 +0000 (16:15 +0000)
server/index.js

index e6a37c7fe71c78ccfa781e94836485b1001e5f37..6493ba48992ead254f06706c228dd7ad5aeb2527 100644 (file)
@@ -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', () => {