What Is a TURN Server?
TURN servers relay video chat data when direct peer-to-peer connections are blocked by firewalls or restrictive network configurations.
A TURN (Traversal Using Relays around NAT) server is a relay that forwards video and audio data between two peers when a direct peer-to-peer connection is impossible. About 10-20% of internet users are behind network configurations that block direct P2P connections — TURN servers ensure these users can still video chat.
Why TURN Servers Exist
In an ideal world, every WebRTC video chat would be a direct peer-to-peer connection. Your video goes straight from your browser to the other person's browser — no middleman, low latency, maximum privacy.
But the internet isn't ideal. Many users are behind:
- Symmetric NATs — Routers that assign different external ports for each destination, breaking direct connectivity
- Corporate firewalls — Networks that block incoming connections and restrict outgoing ones
- Restrictive WiFi — Hotels, airports, universities, and public networks with strict rules
When a STUN server can't help establish a direct connection, TURN provides the fallback: both peers connect to the TURN server, which relays all media data between them.
How TURN Works
- Direct connection attempts fail — ICE tries STUN-discovered addresses and they don't work
- TURN relay candidate is tried — The browser connects to the TURN server and requests a relay allocation
- TURN server allocates relay address — The server reserves an IP:port for relaying this session's data
- Both peers connect to TURN — Each browser sends their media to the TURN server
- TURN forwards data — The server relays audio/video packets from one peer to the other
From the users' perspective, nothing changes — they see and hear each other normally. The relay happens transparently.
TURN vs Direct P2P
| Aspect | Direct P2P | TURN Relay | |--------|-----------|------------| | Latency | Lower (direct path) | Higher (extra hop through server) | | Privacy | Maximum (no middleman) | Server sees encrypted data flow | | Bandwidth cost | Zero for platform | Significant (all media routed through server) | | Reliability | Depends on NAT type | Works almost universally | | Video quality | Best possible | Slightly reduced due to added latency |
Why TURN Is Expensive
TURN servers are the most expensive component of a random video chat platform's infrastructure. Unlike STUN (which just answers "what's my IP?"), TURN must relay the entire video and audio stream — potentially megabytes per second per session.
This is why many platforms charge for advanced features or show ads — the TURN server bandwidth costs money. It's also why some smaller platforms skip TURN entirely, accepting that 10-20% of their users will experience connection failures.
Platforms like Glimr run their own TURN servers to ensure reliable connections for all users, even those on restrictive networks.
TURN Authentication
TURN servers require authentication (unlike STUN) to prevent abuse. Without credentials, anyone could use a TURN server as a free relay proxy. The credentials are typically:
- Generated by the platform's server
- Sent to both clients during the matching phase
- Short-lived (time-limited) to prevent reuse
TURN Deployment Options
Platforms can choose between:
- Self-hosted — Running Coturn or similar software on their own servers (more control, predictable costs)
- Managed services — Using providers like Twilio, Metered.ca, or Xirsys (easier setup, usage-based pricing)
- Hybrid — Self-hosted primary with managed fallback
The choice depends on scale, budget, and technical resources.
Definition
Traversal Using Relays around NAT — a server that relays audio and video data between peers when a direct peer-to-peer connection cannot be established.
Category: Technology