]> git.r.bdr.sh - rbdr/junction/blob - server/events.js
Merge branch 'babel-setup' into 'main'
[rbdr/junction] / server / events.js
1 function addPeer(peerId, shouldCreateOffer) {
2 return {
3 peer_id: peerId,
4 should_create_offer: shouldCreateOffer,
5 }
6 }
7
8 function removePeer(peerId) {
9 return {
10 peer_id: peerId,
11 }
12 }
13
14 function SessionDescriptionReceived(peerId, sessionDescription) {
15 return {
16 peer_id: peerId,
17 session_description: sessionDescription,
18 }
19 }
20
21 function ICECandidateReceived(peerId, ICECandidate) {
22 return {
23 peer_id: peerId,
24 ice_candidate: ICECandidate,
25 }
26 }
27
28 module.exports = {
29 types: {
30 ADD_PEER: 'addPeer',
31 REMOVE_PEER: 'removePeer',
32 RELAY_SESSION_DESCRIPTION: 'relaySessionDescription',
33 RELAY_ICE_CANDIDATE: 'relayICECandidate',
34 ICE_CANDIDATE_RECEIVED: 'ICECandidateReceived',
35 SESSION_DESCRIPTION_RECEIVED: 'SessionDescriptionReceived',
36 },
37 addPeer,
38 removePeer,
39 SessionDescriptionReceived: SessionDescriptionReceived,
40 ICECandidateReceived: ICECandidateReceived,
41 }