How does RTCPeerConnection work in WebRTC

See below sequence diagram.

To be easy understand, no turn/stun/signal server here.

Description

  1. call peerA’s createOffer. Inside createOffer, there are 2 things happening
    1. call peer’s setLocalDescription. The description is known as SDP. It’s peerB’s SDP.
      • setLocalDescription will trigger iceCandidate listener. Inside listener, another 2 things happening
        • get iceCandidate of peerA from WebRTC framework.
        • send the iceCandidate to peerB
    2. send SDP to peerB
  2. When peerB receives SDP, peerB is trying to createAnswer by call peerB’s createAnswer. Inside it, below 2 things are happening
    1. call peerB’s setLocalDescription. The description is know as SDP. It’s peerB’s SDP.
      • setLocalDescription will trigger peerB’s iceCanidate listener.
        • geticeCandiate of peerB from WebRTC framework.
        • send the iceCanddiate to peerA.
    2. send SDP to peer A.
  3. The two peers begin to transfer media data.

Now you see it’s the process of exchange of iceCandidate and SDP.

Leave a Reply

Your email address will not be published. Required fields are marked *