Photo by Jordan Harrison on Unsplash
Why Peer-to-Peer Video Calls Still Need a Server
Video calling tools like to advertise “peer-to-peer” connections as if that means your laptop is talking directly to the other person’s laptop with nothing in between. Under WebRTC, the technology powering most browser-based calling, that’s sometimes true. But a meaningful chunk of the time, your audio and video are actually bouncing through a relay server somewhere in the middle. Understanding why gets at one of the more persistent headaches in networking: almost nobody has a real, routable public IP address anymore.
The NAT Problem
Network Address Translation exists because IPv4 address space ran out decades ago. Your home router has one public IP, but every device behind it (laptop, phone, smart TV) needs to share that single address when talking to the internet. NAT solves this by rewriting packets on the way out, swapping your device’s private address for the router’s public one, and keeping a translation table so replies get routed back to the right device.
This works great for the client-server model the web was built around: your browser opens a connection to a server, the server replies on that same connection, and NAT’s translation table handles the bookkeeping. But it breaks the assumption baked into peer-to-peer protocols, which is that both sides can be reached directly at a known address. If two people behind two different NATs want to connect directly to each other, neither one has an address the other can dial into. There’s no “server” in this picture to anchor the connection.
How WebRTC Tries to Get Around It
WebRTC’s answer is a protocol suite called ICE (Interactive Connectivity Establishment), which leans on two supporting protocols: STUN and TURN.
STUN (Session Traversal Utilities for NAT) is the optimistic path. A STUN server sits on the public internet and simply tells your device what its own public-facing IP and port look like from the outside. Many NATs are “consistent” enough that once both peers exchange this information via a signaling channel, they can punch a direct connection through their respective NATs and talk to each other with no server relaying the actual media. This is the peer-to-peer outcome people picture when they hear WebRTC.
The catch is that not all NATs behave consistently. Symmetric NATs, common on corporate networks and some mobile carriers, assign a different external port for every destination a device talks to. STUN can tell you what port was used to reach the STUN server, but that port won’t necessarily work for reaching the other peer, because the NAT will allocate yet another port for that new destination. No amount of clever guessing fixes this from the outside; the direct path is simply not available.
TURN: The Fallback That Runs More Often Than You’d Think
When direct connection attempts fail, WebRTC falls back to TURN (Traversal Using Relays around NAT). A TURN server is a relay with a public IP that both peers can reach. Instead of peer-to-peer, the architecture becomes peer-to-relay-to-peer: your media goes to the TURN server, and the TURN server forwards it to the other participant. It’s no longer peer-to-peer in any meaningful sense, but it works reliably regardless of what kind of NAT either side is behind.
In practice, TURN relays get used far more often than the “peer-to-peer” branding suggests. Estimates vary by network environment, but a substantial share of real-world WebRTC sessions, especially ones involving mobile networks, enterprise firewalls, or restrictive corporate proxies, end up relayed rather than direct. Group calls make this even more likely, since establishing a full mesh of direct connections between more than two or three participants gets expensive in bandwidth and CPU, so many multi-party calling products route everything through a media server (an SFU, or Selective Forwarding Unit) regardless of NAT conditions.
Why This Still Matters for Building Real-Time Apps
If you’re building anything on WebRTC, the practical implication is that you can’t treat TURN as an edge case. You need TURN infrastructure provisioned and reachable, not just STUN, or a meaningful fraction of your users on restrictive networks will simply fail to connect. TURN servers also cost real bandwidth, since they’re forwarding every byte of media, which is a very different capacity planning problem than a signaling server that just brokers connection setup.
This is also why “peer-to-peer” is a slightly misleading way to market real-time communication products. The protocol is designed to prefer direct connections when possible, as a latency and cost optimization, but the fallback path is doing a lot of quiet, unglamorous work to make sure calls connect at all. The NAT traversal dance of STUN, ICE candidate negotiation, and TURN fallback isn’t a niche corner case bolted onto WebRTC. It’s the load-bearing part of the system that makes real-time communication work reliably across the messy, inconsistent reality of how networks are actually configured.