X-Git-Url: https://git.r.bdr.sh/rbdr/junction/blobdiff_plain/ad7fccbee23e7ab0348bee23a12401fbc650acd2..eadfca7b00e2fb48ffd6b2a0e06c2b6d7e427679:/server/index.js?ds=sidebyside 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);