]> git.r.bdr.sh - rbdr/junction/blob - server/events.js
Update for socket.io 4
[rbdr/junction] / server / events.js
1 export function addPeer(peerId, shouldCreateOffer) {
2 return {
3 peer_id: peerId,
4 should_create_offer: shouldCreateOffer,
5 }
6 }
7
8 export function removePeer(peerId) {
9 return {
10 peer_id: peerId,
11 }
12 }
13
14 export function SessionDescriptionReceived(peerId, sessionDescription) {
15 return {
16 peer_id: peerId,
17 session_description: sessionDescription,
18 }
19 }
20
21 export function ICECandidateReceived(peerId, ICECandidate) {
22 return {
23 peer_id: peerId,
24 ice_candidate: ICECandidate,
25 }
26 }
27
28 export const types = {
29 ADD_PEER: 'addPeer',
30 REMOVE_PEER: 'removePeer',
31 RELAY_SESSION_DESCRIPTION: 'relaySessionDescription',
32 RELAY_ICE_CANDIDATE: 'relayICECandidate',
33 ICE_CANDIDATE_RECEIVED: 'ICECandidateReceived',
34 SESSION_DESCRIPTION_RECEIVED: 'SessionDescriptionReceived',
35 };