-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',
+};