]> git.r.bdr.sh - rbdr/junction/blobdiff - server/events.js
Add new RTC code
[rbdr/junction] / server / events.js
index 99e6b37a47285f01810d04f52d3073a09d108a73..3ef21a9e3c69623276ab46cb8e75e398adeb2646 100644 (file)
@@ -1,27 +1,41 @@
 export function addPeer(peerId, shouldCreateOffer) {
-    return {
-        peer_id: peerId,
-        should_create_offer: shouldCreateOffer,
-    }
+  return {
+    peerId,
+    shouldCreateOffer,
+  }
 }
 
 export function removePeer(peerId) {
     return {
-        peer_id: peerId,
+        peerId,
     }
 }
 
 export function SessionDescriptionReceived(peerId, sessionDescription) {
     return {
-        peer_id: peerId,
-        session_description: sessionDescription,
+        peerId,
+        sessionDescription,
+    }
+}
+
+export function ICECandidateReceived(peerId, candidate) {
+    return {
+        peerId,
+        candidate
+    }
+}
+
+export function offerReceived(peerId, offer) {
+    return {
+        peerId,
+        offer
     }
 }
 
-export function ICECandidateReceived(peerId, ICECandidate) {
+export function answerReceived(peerId, answer) {
     return {
-        peer_id: peerId,
-        ice_candidate: ICECandidate,
+        peerId,
+        answer
     }
 }
 
@@ -30,6 +44,8 @@ export const types = {
   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',
 };