import * as events from './events.js';
const server = new Server(port);
+console.log(`Listening on port ${port}`);
const sockets = {};
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)
});
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))
});
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))