- socket.to(data.peerId).emit(events.types.ICE_CANDIDATE_RECEIVED, events.ICECandidateReceived(me, data.candidate))
- console.log(`[RELAY_ICE_CANDIDATE] ICE candidate for client ${me} has been relayed to all peers`);
- });
-
- socket.on('relayOffer', async (data) => {
-
- socket.to(data.peerId).emit(events.types.OFFER_RECEIVED, events.offerReceived(me, data.offer))
- console.log(`[RELAY_OFFER] ICE offer for client ${me} has been relayed to all peers`);
- });
-
- socket.on('relayAnswer', async (data) => {
+ socket.on(events.types.RELAY_OFFER, async ({ offer, peerId }) => {
+ events.offerReceived(me, offer)(socket.to(peerId));
+ });