]>
git.r.bdr.sh - rbdr/junction/blob - server/events.js
18b9dd45e9c00bd4ec7da0e1c4ea8ce8fb383ba5
2 emitter(name
, data
, socket
) {
3 socket
.emit(name
, data
);
4 console
.debug(`[${name}] ${JSON.stringify(data)}`);
10 CONNECTION: "connection",
12 DISCONNECTING: "disconnecting",
13 RELAY_ICE_CANDIDATE: "relayICECandidate",
14 RELAY_OFFER: "relayOffer",
15 RELAY_ANSWER: "relayAnswer",
19 REMOVE_PEER: "removePeer",
20 OFFER_RECEIVED: "offerReceived",
21 ANSWER_RECEIVED: "answerReceived",
22 ICE_CANDIDATE_RECEIVED: "ICECandidateReceived",
25 export function addPeer(peerId
, shouldCreateOffer
) {
26 return internals
.emitter
.bind(null, types
.ADD_PEER
, {
32 export function removePeer(peerId
) {
33 return internals
.emitter
.bind(null, types
.REMOVE_PEER
, {
38 export function ICECandidateReceived(peerId
, candidate
) {
39 return internals
.emitter
.bind(null, types
.ICE_CANDIDATE_RECEIVED
, {
45 export function offerReceived(peerId
, offer
) {
46 return internals
.emitter
.bind(null, types
.OFFER_RECEIVED
, {
52 export function answerReceived(peerId
, answer
) {
53 return internals
.emitter
.bind(null, types
.ANSWER_RECEIVED
, {