X-Git-Url: https://git.r.bdr.sh/rbdr/junction/blobdiff_plain/ad7fccbee23e7ab0348bee23a12401fbc650acd2..1d73636a839a4efe8e12cffb33714bc60c58dc4b:/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);