]> git.r.bdr.sh - rbdr/junction/blobdiff - server/events.js
Update for socket.io 4
[rbdr/junction] / server / events.js
index 062b7c1e7989dfc379ef5b5386c8799d56c3ce74..99e6b37a47285f01810d04f52d3073a09d108a73 100644 (file)
@@ -1,41 +1,35 @@
-function addPeer(peerId, shouldCreateOffer) {
+export function addPeer(peerId, shouldCreateOffer) {
     return {
         peer_id: peerId,
         should_create_offer: shouldCreateOffer,
     }
 }
 
-function removePeer(peerId) {
+export function removePeer(peerId) {
     return {
         peer_id: peerId,
     }
 }
 
-function SessionDescriptionReceived(peerId, sessionDescription) {
+export function SessionDescriptionReceived(peerId, sessionDescription) {
     return {
         peer_id: peerId,
         session_description: sessionDescription,
     }
 }
 
-function ICECandidateReceived(peerId, ICECandidate) {
+export function ICECandidateReceived(peerId, ICECandidate) {
     return {
         peer_id: peerId,
         ice_candidate: ICECandidate,
     }
 }
 
-module.exports = {
-    types: {
-        ADD_PEER: 'addPeer',
-        REMOVE_PEER: 'removePeer',
-        RELAY_SESSION_DESCRIPTION: 'relaySessionDescription',
-        RELAY_ICE_CANDIDATE: 'relayICECandidate',
-        ICE_CANDIDATE_RECEIVED: 'ICECandidateReceived',
-        SESSION_DESCRIPTION_RECEIVED: 'SessionDescriptionReceived',
-    },
-    addPeer,
-    removePeer,
-    SessionDescriptionReceived: SessionDescriptionReceived,
-    ICECandidateReceived: ICECandidateReceived,
-}
\ No newline at end of file
+export const types = {
+  ADD_PEER: 'addPeer',
+  REMOVE_PEER: 'removePeer',
+  RELAY_SESSION_DESCRIPTION: 'relaySessionDescription',
+  RELAY_ICE_CANDIDATE: 'relayICECandidate',
+  ICE_CANDIDATE_RECEIVED: 'ICECandidateReceived',
+  SESSION_DESCRIPTION_RECEIVED: 'SessionDescriptionReceived',
+};