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', () => {