X-Git-Url: https://git.r.bdr.sh/rbdr/junction/blobdiff_plain/ac259c8645783dcb92fc0eafff166769f5216aa9..284fc661dc7f18aa32d0dbcd8e7f98cb16af4bb7:/server/events.js diff --git a/server/events.js b/server/events.js index 062b7c1..3ef21a9 100644 --- a/server/events.js +++ b/server/events.js @@ -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 { - peer_id: peerId, - should_create_offer: shouldCreateOffer, + peerId, + sessionDescription, } } -function removePeer(peerId) { +export function ICECandidateReceived(peerId, candidate) { return { - peer_id: peerId, + peerId, + candidate } } -function SessionDescriptionReceived(peerId, sessionDescription) { +export function offerReceived(peerId, offer) { return { - peer_id: peerId, - session_description: sessionDescription, + peerId, + offer } } -function ICECandidateReceived(peerId, ICECandidate) { +export function answerReceived(peerId, answer) { 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', +};