- npm install mkcert -g
- mkcert create-ca
- mkcert create-cert
- OPTIONAL: to run it locally, update the files with your local IP
- getUserMedia() is run - CLIENT1/Init/Caller/Offerer
- CLIENT1 creates an RTCPeerConnection object called peerConnection
- the new peerConnection needs STUN servers so other clients can find
- they will create ICE candidates, for use later
- CLIENT1 adds localstream tracks (from GUM) to peerConnection
- we need to associate CLIENT1 feed with peerConnection
- CLIENT1 creates an offer
- offer requires a peerConnection with tracks
- offer = RTCSessionDescription, an object with 2 properties
- SDP - codec and other information
- Type (offer)
- CLIENT1 passes offer to peerConnection.setLocalDescription
- (ASYNC)ICE candidates can now start coming in
Signal server needs to be running for 8 on
- signal server is a node server, it enables the browsers to find/talk each other
- CLIENT1 emits offer to the signal server (socket.io/node)
- socket.io server holds it for the other browser
- associate with CLIENT1
- (ASYNC) As 7 happens, emit ICE candidates up to the signaling server
- socket.io server holds it for when another client responds
- associate the ICE candidates with CLIENT1
- CLIENT2 loads up the webpage
- io.connect() runs and connects to the socket.io server
- socket.io emits out the RTCSessionDescription to the new client
- RTCSessionDescription = an offer
- CLIENT2 runs getUserMedia()
- CLIENT2 creates a peerConnection
- pass in the STUN servers
- CLIENT2 adds its localstream tracks to peerconnection
- CLIENT2 creates an answer with createAnswer()
- createAnswer = RTCSessionDescription
- same as #5, but with a type of "answer"
- CLIENT2 hands answer to peerconnection.setLocalDescription()
- CLIENT2 has the offer (CLIENT1's SDP)
- CLIENT2 can pass the offer to peerconnection.setRemoteDescription()
- (ASYNC) Once #16 runs, CLIENT2 can start collecting ICE candidates
- CLIENT2 emits answer (RTCSessionDesc - sdp/type) up to signaling server
- (ASYNC) CLIENT2 will listen for tracks/ICE from remote.
- and is done.
- waiting on ICE candidates from CLIENT1
- waiting on tracks from CLIENT1
- signaling server has been listening for answer. On arrival
- emit CLIENT2 answer to CLIENT1 (RTCSessionDesc - sdp/type)
- CLIENT1 takes the answer and passes it to pc.setRemoteDescription()
- (ASYNC) CLIENT1 waits for ICE candidates and tracks
- Once they are exchanged, tracks will exchange