aboutsummaryrefslogtreecommitdiff
path: root/server/events.js
diff options
context:
space:
mode:
authorrknol <rknol@MacBook-Pro-2.fritz.box>2020-09-27 17:38:43 +0200
committerrknol <rknol@MacBook-Pro-2.fritz.box>2020-09-27 17:38:43 +0200
commited9f8fd50086439ff3de12092af2f813763ada91 (patch)
tree59120bb83803110a4b7f5e19f300c75e84c51e76 /server/events.js
parentd75b263c0b08ac7c729cc7bb98df99f3c4ec6ab4 (diff)
First implementation of the socket server
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