Web Development

What is WebRTC and how does it work?

WebRTC explained: how browsers make peer-to-peer audio and video calls using signalling, STUN, TURN and ICE, and why every WebRTC call is encrypted by default.

  • 7 min read
  • 5 questions
  • +35 XP
Transcript

WebRTC, explained by cats. Kitty wants to video chat. Face to face. Right now. Sending video through a server? Slow and Expensive. Too many hops. Too much chaos. So Kitty uses WebRTC. WebRTC lets two cats talk directly. Browser to browser.

Audio. Video. All the meows. But first. the cats need to find each other. They use a small helper server. Just for introductions. This is called signaling. Once that’s done, the server steps away. Now WebRTC looks for the shortest path.

If there’s a fence or firewall, it asks for help. STUN protocol finds the cat’s public address. TURN protocol relays meows if firewall too strict. TURN is the last resort. It cost alot of tuna. If direct link works then no servers in the middle Audio and Video flows seamlessly. Everything is encrypted by default. That’s WebRTC. real-time communication, peer-to-peer by default, server-assisted when needed,