Skip to main content

Glossary

TURN server

Also called: TURN relay, Traversal Using Relays around NAT

A TURN (Traversal Using Relays around NAT) server is a relay on the public internet that forwards media between devices when firewalls or network address translation stop them from connecting directly. It is the last-resort path in a WebRTC call.

Reviewed

Why calls need a relay

WebRTC tries to send audio and video peer-to-peer. But most devices sit behind NAT, and some network setups make a direct path impossible: symmetric NATs that assign a new public port for every destination, carrier-grade NAT on mobile networks, and corporate or public Wi-Fi firewalls that block UDP or unusual ports. In those cases, both devices can still reach a server on the internet, so a TURN server sits in the middle and forwards packets between them.

STUN vs TURN

The two helper servers in WebRTC connectivity
Job
STUN:Tells a device its public IP and port
TURN:Relays all media between devices
Carries call audio/video?
STUN:No
TURN:Yes
Cost to run
STUN:Very low
TURN:High — every relayed byte crosses the server
Works when
STUN:NATs allow hole punching
TURN:Almost always, including strict firewalls

Both are IETF standards. TURN is an extension of STUN, and many servers do both.

How ICE decides to use TURN

  1. 1

    Gather candidates

    Each device collects possible addresses: host (its local address), server-reflexive (its public address, learned via STUN) and relay (an address allocated on the TURN server).

  2. 2

    Exchange them

    Candidates travel between the devices over the app's signaling channel.

  3. 3

    Check pairs

    ICE tests candidate pairs, generally preferring direct routes over relayed ones.

  4. 4

    Pick one

    The best working pair is used. If only relay pairs succeed, the call goes through TURN — over UDP, TCP, or TLS on port 443 when a firewall allows nothing else.

On Asyncbit

Asyncbit's voice and video calls use WebRTC with a TURN relay, so when a direct connection isn't possible — common on mobile data and restrictive networks — the call is relayed instead of failing to connect. Calls start from a chat, 1:1 or group, in the browser or on Android. Group calls hold up to 8 people, with video for up to 4; larger calls continue as audio. Chats get a summary line afterwards, such as “Missed audio call”.

See it for yourself

Asyncbit is free, with no paid tier and no ads. Everything described here is available from the first day.

Create your free account