aboutsummaryrefslogtreecommitdiff
path: root/server/events.js
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2020-09-27 18:15:07 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2020-09-27 18:15:07 +0200
commit27a1c981529492981f08bb1c0ece4cb5d615c19b (patch)
tree2489650e871d5c898452008a074d19505b15a7a4 /server/events.js
parenta94a5407e22b3287db369edad92679f98bc2cb52 (diff)
parenta69b770cb379354226a8c05be5cbea3e8703803f (diff)
Merge branch 'main' of gitlab.com:rbdr/junction into main
Diffstat (limited to 'server/events.js')
-rw-r--r--server/events.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/server/events.js b/server/events.js
new file mode 100644
index 0000000..062b7c1
--- /dev/null
+++ b/server/events.js
@@ -0,0 +1,41 @@
+function addPeer(peerId, shouldCreateOffer) {
+ return {
+ peer_id: peerId,
+ should_create_offer: shouldCreateOffer,
+ }
+}
+
+function removePeer(peerId) {
+ return {
+ peer_id: peerId,
+ }
+}
+
+function SessionDescriptionReceived(peerId, sessionDescription) {
+ return {
+ peer_id: peerId,
+ session_description: sessionDescription,
+ }
+}
+
+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