An architectural overview for WebRTC — A protocol for implementing video conferencing

Source: Google
See Git Streamer (Alpha)
Source: Wowza

WebRTC overview

See: RTCPeerConnection, the most primitive WebRTC class

Peer connections

A system of 4 peers

Signaling server

When I join a conversation, I broadcast it with the signaling server so everyone can know about it

SDP

Source: researchgate.net
Connecting 2 peers with their SDPs

ICE candidates

An actual RTCIceCandidate instance
As soon as we create an SDP, WebRTC starts looking for ICE candidates

NAT

Illustration: A peer with destination IP/port, tries to establish a connection with us by making a request to one of our router’s public IPs/ports, which will then be translated to our machine’s private IP/port.
  • Private IP/port
  • Public IP/port
  • Destination IP/port

STUN

STUN is a standardized set of methods, including a network protocol, for traversal of network address translator (NAT) gateways in applications of real-time voice, video, messaging, and other interactive communications. — Wikipedia

  • Let peer A and peer B with full cone NATs.
  • Peer A will get information about its public IP/port using the STUN server.
  • Peer A will send that information to peer B using the signaling server.
  • Peer B will get that information and will try to establish a connection with peer A.
  • Same goes the other way around.
Source: MDN

Hole punching

  • Let peer A with a restricted cone NAT, and peer B with a full cone NAT.
  • Peer A will get information about its public IP/port using the STUN server.
  • Peer A will send that information to peer B using the signaling server.
  • Peer B will get that information and will try to establish a connection with peer A.
  • Peer B will fail to establish a connection, but it will store peer A public information in its NAT table.
  • Peer A will try to establish a connection with peer B. Since peer A already exists in peer B NAT table, the connection is accepted.
  • Peer A will store public information about peer B.
  • Peer B can now establish a connection with peer A.

TURN

  • Let peer A with symmetric NAT, and peer B with a full cone NAT.
  • Peer A will get information about its public IP/port using the STUN server.
  • Peer A will send that information to peer B using the signaling server.
  • Peer B will get that information and will try to establish a connection with peer A.
  • Peer B will fail to establish a connection, but it will store peer A public information in its NAT table.
  • Peer A will try to establish a connection with peer B. However, peer B will reject peer A, because the public information stored in its NAT table is actually different than the one it actually received.

Traversal Using Relays around NAT (TURN) is a protocol that assists in traversal of network address translators (NAT) or firewalls for multimedia applications. — Wikipedia

Source: MDN
  • Media Streams — how can you get data from the camera and microphone and stream it over to your peers using WebRTC.
  • Data Channels — how can you send data JSONs across your peers using WebRTC.
  • Reducing latency and costs of TURN transactions with multi-regional deployment.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store