Networking & Protocols (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What is WebRTC and how does NAT Traversal work (STUN, TURN, ICE)?
senior Levelnetworking-protocolsAdvanced Internals
In Simple Words: WebRTC enables direct Peer-to-Peer (P2P) audio, video, and data streaming between browsers:
- The NAT Problem: Most home devices have private internal IPs (
192.168.1.5) hidden behind home routers with Network Address Translation (NAT). - STUN (Session Traversal Utilities for NAT): A public server tells the client its public IP and external port mapping.
- TURN (Traversal Using Relays around NAT): Fallback relay server used when symmetric firewalls block direct P2P connections.
- ICE (Interactive Connectivity Establishment): Framework that tests all possible connection candidates (direct, STUN, TURN) and picks the fastest path.