Cloudflare Realtime · TURN + Serverless SFU

Serverless SFU + TURN, priced by egress, running at every Cloudflare edge. Below: the math for mesh vs SFU, real per-GB pricing vs Twilio, and how a full Realtime app runs entirely on Cloudflare.
New to WebRTC? Start here — what are TURN and SFU? 2 minute read

WebRTC is the standard that lets two browsers (or apps) send audio and video directly to each other in real time — the tech behind Zoom, Google Meet, Discord voice, and every video-in-a-browser app you’ve used. It’s built into every modern browser. No plugin required.

The catch: for two clients to send packets directly to each other, they need to know each other’s public IP and be reachable. Most devices sit behind a NAT (Network Address Translation) — your home router, a corporate firewall, a mobile carrier — that hides the real IP and blocks unsolicited inbound traffic. About 30% of the internet can’t do direct WebRTC because of this. That’s where TURN and SFU come in.

TURN
Traversal Using Relays around NAT
A public relay server. When two clients can’t connect directly, both dial outbound to the TURN server (which NAT allows), and TURN forwards packets between them. Every WebRTC app on the internet has TURN configured as a fallback.
Analogy: two people in offices that block incoming calls. They both call a shared switchboard, and the operator patches them through.
SFU
Selective Forwarding Unit
A media routing server. Each client uploads its video once to the SFU. The SFU fans that stream out to every other participant. This is how any call with more than 3 or 4 people actually works — peer-to-peer meshes collapse at that size.
Analogy: a radio tower. Every DJ sends their signal to the tower once. The tower broadcasts it to every listener.
Cloudflare Realtime is the managed service that provides both. TURN and SFU running at 300+ Cloudflare edges, priced at $0.05 per GB of egress (first 1 TB free every month), with no servers to run, no regions to pick, and standard WHIP/WHEP protocols so you’re not locked in. Below is the math for why an SFU beats a mesh, what it costs vs Twilio, and how a full Realtime app fits together on Cloudflare.
Mesh doesn't scale. SFU does.
In a mesh, every client sends video to every other client. Uploads and connections grow quadratically. An SFU (Selective Forwarding Unit) takes one upload per client and fans it out. Cloudflare runs SFUs at the edge — no servers to provision.
6
Mesh (peer-to-peer)
every client uploads to every other client
Connections
15
Uploads per client
5
Transport: direct UDP between peers (dynamic ports 10000–65535)
Signaling: your app must exchange ICE candidates + SDP
Blocked by symmetric NAT and most corporate firewalls — fails for ~30% of users.
SFU (Cloudflare Realtime)
one upload per client, edge fans it out
Connections
6
Uploads per client
1
Transport: outbound-only to Cloudflare on UDP 3478 (STUN/TURN) or TCP/TLS 443 (fallback)
Signaling: WHIP for publish, WHEP for subscribe (HTTP standards)
Works from every network. NAT allows outbound. Same anycast IPs at 300+ edges.
At 6 participants, mesh needs 15 connections and 5 uploads per client. SFU needs 6 connections and 1 upload per client. Drag the slider — watch mesh explode.
Turn the topology math into dollars
Cloudflare Realtime bills only outbound egress at $0.05/GB, with 1,000 GB free per month. Inbound is free. TURN + SFU share one line item — no double billing.
Mesh: per-client uplink (this is what breaks)
SFU: per-client uplink (constant, one stream)
Cloudflare-billable egress (server → clients)
— GB/mo
Twilio Video (~$0.004/participant-min, bundled)
$ —
Cloudflare Realtime ($0.05/GB, 1TB free)
$ —
Estimated savings
— / mo
Twilio bundles routing + bandwidth into a flat per-participant-minute rate. Cloudflare charges only egress. At low bitrates / big room counts, Cloudflare wins. At small rooms of long 1080p calls, Twilio's bundle can be cheaper. Adjust the sliders to find your crossover.
A full Realtime app runs entirely on Cloudflare
No origin. No VMs. Signaling on Workers, room state in a Durable Object, media through the Realtime SFU, recordings to R2, playback via Stream. Everything on the same anycast network.
Browser / App WebRTC + WHIP/WHEP Browser / App WebRTC + WHIP/WHEP CLOUDFLARE GLOBAL NETWORK Workers signaling / auth mint TURN creds Durable Object room state participant list Realtime TURN + SFU media routing at 300+ edges R2 recordings zero egress Stream playback HLS / DASH media (WebRTC) signaling (HTTPS / WebSocket)
Workers
Signaling endpoints, auth, mints short-lived TURN credentials.
Durable Object
One per room. Holds participant list, permissions, chat state.
Realtime SFU + TURN
Routes media across the edge. WHIP/WHEP compatible.
R2
Session recordings. Zero egress fees when clients pull them back.
Stream
On-demand playback of recordings via HLS/DASH.