Creating a WebRTC Application

In notebook:
FrontEndMasters Real-Time Web with Node.js
Created at:
2015-10-15
Updated:
2015-10-15
Tags:
JavaScript
5:11:52 - 5:20:52 Creating a WebRTC Application The final exercise is a WebRTC application. Kyle walks through setting up the initial handshake facilitated by Socket.io on the server. Then Kyle scripts each client to communicate to each other through a RTCPeerConnection.
same pattern as websockets

server side

​socket.on("signal", function(msg){
  socket.broadcast.emit(msg);
}

client side

get the video cam

caller = identification;

if (caller) {
    console.log("CALLER!!");
    ASQ(getMediaStream)
    .seq(sendOffer)
    .then(getRemoteSDP)
    .pipe(done);
}

the vide cam receiver

​else {​ from above then:

ASQ().gate(
    getRemoteSDP,
    getMediaStream
).
seq(sendAnswer)
.pipe(done);
}

it's easy(ier) with a flow control library (here: ASQ)