]> git.r.bdr.sh - rbdr/junction/blobdiff - server/events.js
Add new RTC code
[rbdr/junction] / server / events.js
index 062b7c1e7989dfc379ef5b5386c8799d56c3ce74..3ef21a9e3c69623276ab46cb8e75e398adeb2646 100644 (file)
@@ -1,41 +1,51 @@
-function addPeer(peerId, shouldCreateOffer) {
+export function addPeer(peerId, shouldCreateOffer) {
+  return {
+    peerId,
+    shouldCreateOffer,
+  }
+}
+
+export function removePeer(peerId) {
+    return {
+        peerId,
+    }
+}
+
+export function SessionDescriptionReceived(peerId, sessionDescription) {
     return {
     return {
-        peer_id: peerId,
-        should_create_offer: shouldCreateOffer,
+        peerId,
+        sessionDescription,
     }
 }
 
     }
 }
 
-function removePeer(peerId) {
+export function ICECandidateReceived(peerId, candidate) {
     return {
     return {
-        peer_id: peerId,
+        peerId,
+        candidate
     }
 }
 
     }
 }
 
-function SessionDescriptionReceived(peerId, sessionDescription) {
+export function offerReceived(peerId, offer) {
     return {
     return {
-        peer_id: peerId,
-        session_description: sessionDescription,
+        peerId,
+        offer
     }
 }
 
     }
 }
 
-function ICECandidateReceived(peerId, ICECandidate) {
+export function answerReceived(peerId, answer) {
     return {
     return {
-        peer_id: peerId,
-        ice_candidate: ICECandidate,
+        peerId,
+        answer
     }
 }
 
     }
 }
 
-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',
+       OFFER_RECEIVED: 'offerReceived',
+       ANSWER_RECEIVED: 'answerReceived',
+  ICE_CANDIDATE_RECEIVED: 'ICECandidateReceived',
+  SESSION_DESCRIPTION_RECEIVED: 'SessionDescriptionReceived',
+};