X-Git-Url: https://git.r.bdr.sh/rbdr/junction/blobdiff_plain/80172072ed99b14e3d5b435b097888a4621f78bc..139f43c6caf963d66704fe1675bcc70735e21926:/server/index.js diff --git a/server/index.js b/server/index.js index 2508408..37104e1 100644 --- a/server/index.js +++ b/server/index.js @@ -3,6 +3,7 @@ import { port } from './config.js'; import * as events from './events.js'; const server = new Server(port); +console.log(`Listening on port ${port}`); const sockets = {}; @@ -14,7 +15,7 @@ server.on('connection', (socket) => { socket.on('join', (data) => { socket.join(data.url); - const sockets = server.sockets.adapter.rooms.get(data.url); + const sockets = server.of(data.url).sockets.keys(); sockets.forEach((peerId) => { if (peerId !== me) { const peer = server.sockets.sockets.get(peerId) @@ -33,7 +34,7 @@ server.on('connection', (socket) => { }); socket.on('relayICECandidate', (data) => { - const sockets = server.sockets.adapter.rooms.get(data.url); + const sockets = server.of(data.url).sockets.keys(); sockets.forEach((peerId) => { const peer = server.sockets.sockets.get(peerId) peer.emit(events.types.ICE_CANDIDATE_RECEIVED, events.ICECandidateReceived(me, data.ice_candidate)) @@ -43,7 +44,7 @@ server.on('connection', (socket) => { }); socket.on('relaySessionDescription', (data) => { - const sockets = server.sockets.adapter.rooms.get(data.url); + const sockets = server.of(data.url).sockets.keys(); sockets.forEach((peerId) => { const peer = server.sockets.sockets.get(peerId) peer.emit(events.types.SESSION_DESCRIPTION_RECEIVED, events.SessionDescriptionReceived(me, data.session_description))