X-Git-Url: https://git.r.bdr.sh/rbdr/junction/blobdiff_plain/ad7fccbee23e7ab0348bee23a12401fbc650acd2..93fe1aee43a79a23d4c418c230fde0e451259279:/server/index.js diff --git a/server/index.js b/server/index.js index ebdede7..de05616 100644 --- a/server/index.js +++ b/server/index.js @@ -20,9 +20,11 @@ io.sockets.on('connection', (socket) => { console.log(`[CONNECT] New client connected with ID ${me}`); socket.on('join', (data) => { - Object.keys(io.in(data.url).sockets).forEach(peer => { - peer.emit(events.types.ADD_PEER, events.addPeer(me, false)); - socket.emit(events.types.ADD_PEER, events.addPeer(peer, true)); + Object.entries(io.in(data.url).sockets).forEach(([peerId, peer]) => { + if (peerId !== me) { + peer.emit(events.types.ADD_PEER, events.addPeer(me, false)); + socket.emit(events.types.ADD_PEER, events.addPeer(peerId, true)); + } }); socket.join(data.url);