STUN, TURN, and why your video call sometimes works (or not)
If you only remember one acronym pair for browser chat, make it STUN and TURN. They exist because most people sit behind NATs (network address translators) and firewalls that hide how traffic should return to their device. Understanding them explains why the same site works on home Wi‑Fi and fails on hotel or office networks.
Direct answer
STUN helps your browser learn a public-facing address so peers can try a direct path. TURN relays media when direct paths fail. Apps still use a signaling channel to exchange candidates; STUN/TURN do not replace matching or chat servers.
Why NATs break naive peer connections
Home routers and mobile carriers rewrite addresses so many devices can share one public IP. That is great for IPv4 scarcity and terrible for “just send UDP to my friend.”
Browser A -----> Home NAT/Firewall -----+
| +--> STUN: "your public ip:port is …"
+-----+
| +--> try direct UDP/TCP to B
Browser B -----> Carrier NAT -----------+
|
if blocked
|
v
TURN relay host
(media forwarded)
STUN discovers reflexive addresses for direct tries; TURN relays when NATs or firewalls block peer paths.
Symmetric NATs and strict enterprise firewalls are especially likely to need relay.
STUN: “What is my public address?”
A STUN server answers a simple question: from the internet’s point of view, what IP and port appear when your browser sends a packet? That answer becomes a server-reflexive ICE candidate.
Important limits:
- STUN is lightweight and relatively cheap to operate.
- Querying STUN reveals your public IP to that STUN service—it is not a privacy VPN.
- STUN alone does not carry your voice/video payloads for the whole call.
TURN: “Please relay my packets”
When direct candidates fail, browsers can send media to a TURN relay, which forwards to the other peer. Consequences:
- Higher latency and bandwidth cost on the operator side
- Higher chance the call works at all on hostile networks
- The relay host handles media bytes for that session (still typically encrypted between peers via WebRTC/DTLS-SRTP—do not confuse transport encryption with “the operator knows nothing”)
Services often ship ICE configuration (STUN/TURN URLs and short-lived credentials) from their backend so browsers do not hardcode secrets. Users should never see or share long-lived relay passwords.
Signaling still sits in the middle
Even with perfect STUN/TURN, peers must exchange SDP and candidates through the app’s realtime channel (for example SignalR). The application server therefore learns who matched whom and timing metadata even if media later bypasses it. See how browser voice chat works and how SignalR powers realtime chat.
Troubleshooting map for users
| Symptom | Likely layer | What to try |
|---|---|---|
| Never connects on hotel Wi‑Fi, works at home | NAT / firewall → needs TURN or blocked UDP | Switch networks; try phone cellular; fall back to text |
| Connects but choppy | Bandwidth, Wi‑Fi interference, relay congestion | Headphones; closer to AP; lower mode (voice vs video) |
| One-way audio | Device permissions, mute, capture device | Check mute and site permissions |
| Works in text only | Media path or permission denial | Re-allow mic/camera; see permission guide |
Latency deep dive: why voice chat sometimes has high latency. Mobile specifics: mobile random chat browser tips.
Privacy expectations (accurate, not magical)
- STUN sees reflective address queries.
- TURN may relay media when used.
- The chat app sees signaling and matchmaking metadata.
- “Browser-only” does not mean “no servers involved.”
For visitor habits around nicknames and permissions, use the browser privacy checklist.
Conclusion
When video fails on one network and works on another, suspect ICE path selection—STUN discovery versus TURN relay—before assuming the product is “down.” Direct paths are ideal; relays are the safety net that makes stranger voice/video possible across the messy real internet.
Related reading: How browser voice chat works · Why voice chat sometimes has high latency · Random video chat in your browser · Mobile random chat tips