Skip to content
AnswerWell geo Documentation

Research · 8 min read · Answerwell

Durable Objects Video Call WebRTC WebSocket and TURN

How Cloudflare's Durable Objects learning path builds a video call app with WebSockets, WebRTC, room IDs, media controls, and TURN.

This page summarizes Cloudflare’s Durable Objects course learning-path series. The series walks through a sample video-call application (starter code is described as living in the Veet GitHub repository) that uses Durable Objects for coordination, WebSockets for real-time signaling, WebRTC for peer video, and TURN for connectivity behind restrictive networks.

Durable Objects: what they do in a video call app

Section titled “Durable Objects: what they do in a video call app”

A video call needs something that stays online long enough to match users to a room, track who is connected, and relay signaling—not only stateless HTTP. In this course, Durable Objects provide that server-side anchor.

In this video, we show how Durable Objects work and start building a video call app together.

— Cloudflare, What are Durable Objects?

Each call room is addressed with a call room ID. Clients connect to the object responsible for that room so signaling and presence stay consistent for everyone in the same room. The series introduces Durable Objects in episode 2, then builds the backend and frontend in later episodes rather than treating them as a standalone product overview.

How this differs from other real-time products in the wider docs

Section titled “How this differs from other real-time products in the wider docs”

The cluster also includes brief pages on Cloudflare Mesh, SFU sessions and tracks, and telephony agents. Those are separate architectures (mesh VPN, SFU media, PSTN voice). This learning path is specifically a Durable Objects + WebSocket + WebRTC peer model, not a full SFU or Mesh setup. If you need SFU-style publish/subscribe semantics, Cloudflare documents that under Realtime SFU concepts such as Sessions and tracks—a different path from the Veet-style app in this series.

Serverless WebSocket backend: first Durable Object and client tracking

Section titled “Serverless WebSocket backend: first Durable Object and client tracking”

Before the UI can place calls, the course adds a WebSocket layer on Workers serverless infrastructure so the app can accept and coordinate live connections.

In this video, we’ll create a WebSocket backend using serverless technology, making the process simpler than ever before. You’ll learn how to create your first Durable Object, set up a WebSocket server to coordinate connections, and keep track of connected clients.

— Cloudflare, Create a serverless websocket ‘backend’

In practice, that means:

  1. Defining a Durable Object that owns WebSocket handling for a room or namespace.
  2. Accepting WebSocket upgrades on your Worker and routing them to the correct object instance.
  3. Maintaining awareness of which clients are currently connected so later signaling can target them.

The episode positions this as simpler than operating a traditional always-on WebSocket server because the object and Worker scale with Cloudflare’s platform, but you still must design routing (which ID maps to which object) and connection lifecycle explicitly—topics the next episode extends.

Real-time messaging: route, broadcast, and handle closed WebSockets

Section titled “Real-time messaging: route, broadcast, and handle closed WebSockets”

Once sockets are accepted, the backend must move messages between participants and survive ordinary failure modes such as a client disconnecting.

Now, we’ll take it a step further by enabling our server to receive and broadcast messages. In this video, you’ll learn how to route and broadcast incoming messages from WebSocket connections and implement error handling such as closed WebSocket connections. By the end, you will have completed the backend for our video call app.

— Cloudflare, Real-time messaging with WebSockets

Routing here means deciding which connection or room should receive a given message; broadcasting means fan-out to every participant that should see the same event (for example, presence or call-state updates). Error handling for closed WebSocket connections matters because WebRTC signaling is fragile if you assume sockets stay open: the course calls out handling closures so the room state does not reference dead peers indefinitely.

Build the app frontend and UI: starter code, room ID, local preview

Section titled “Build the app frontend and UI: starter code, room ID, local preview”

The frontend episode connects the browser to the Durable Object layer using the same call room ID model introduced earlier.

In this video, we set up the frontend starter code (the starter code is located in the Veet GitHub repository), connect to Durable Objects using a call room ID, and display a local video preview.

— Cloudflare, Build the app frontend and UI

A reader trying to reproduce the app should expect three concrete outcomes from this step:

Goal What the episode covers
Bootstrap UI Configure the course’s frontend starter (Veet repo)
Join a room Connect to Durable Objects via a call room ID
Verify capture Show a local video preview before placing a call

Until local preview works, later WebRTC work has no baseline to test against. The room ID is the stable key that ties the browser session to the correct Durable Object instance on the backend.

Make and answer WebRTC calls: peers, ICE, and media streams

Section titled “Make and answer WebRTC calls: peers, ICE, and media streams”

With signaling in place over WebSockets, the course adds true peer-to-peer video between users.

In this video, we build on the frontend we set up earlier by adding functionality for making and answering WebRTC video calls. You will learn how to create peer-to-peer connections, handle ICE candidates, and seamlessly send and receive video streams between users.

— Cloudflare, Make and answer WebRTC calls

WebRTC in this app implies:

  • Peer connections for each call leg you initiate or accept.
  • ICE candidates exchanged through your existing signaling path (the Durable Object–backed WebSocket layer), so browsers can discover reachable network paths.
  • Send and receive video streams once the peer connection is established.

The same episode description appears across the series navigation blocks, which reinforces that episodes 5 (frontend) and 6 (WebRTC) are sequential dependencies: attempting episode 6 without a working room connection and local preview from episode 5 leaves out prerequisites the videos assume.

Layer Technology in this course Responsibility
Signaling WebSockets via Durable Objects Room membership, call setup messages, ICE
Media WebRTC Encoded audio/video between peers

Keeping that split clear helps when debugging: signaling problems show up as connection timeouts or missing ICE; media problems often appear after RTCPeerConnection reaches a connected state.

Deploy your video call app: disconnections, controls, and TURN

Section titled “Deploy your video call app: disconnections, controls, and TURN”

The final episode finishes operability concerns production users hit immediately: dropped calls, mute/camera toggles, and firewall traversal.

We are almost done with the project, and in this final episode, we add the finishing touches, such as learning how to handle call disconnections, wiring up essential media controls like muting/unmuting and video toggling, and integrating a TURN server to ensure reliable connections even behind firewalls. By the end of this video, your app will be fully functional and ready for deployment.

— Cloudflare, Deploy your video call app

Call disconnections need explicit handling so UI state, Durable Object room state, and open WebRTC peers stay aligned when someone leaves or loses network.

Media controls in the sample app include muting and unmuting audio and toggling video—basic expectations for any call UI and hooks into MediaStreamTrack enablement on the client.

TURN integration addresses cases where direct peer connectivity fails (symmetric NAT, strict firewalls). The related-resources lists in several episodes point readers to Cloudflare TURN service documentation alongside Durable Objects documentation; this deploy episode is where the course actually integrates TURN so calls remain usable outside ideal network conditions.

Section titled “Suggested episode order and related material”

The series pages cross-link the same episode list. For a coherent build, follow the narrative order the URLs imply:

Order Episode focus Page
1 Series overview Introduction to the series
2 Durable Objects concepts What are Durable Objects?
3 WebSocket backend Create a serverless websocket ‘backend’
4 Messaging and backend completion Real-time messaging with WebSockets
5 Frontend and preview Build the app frontend and UI
6 WebRTC calling Make and answer WebRTC calls
7 Production polish Deploy your video call app

Repeated “Related content” bullets on those pages also name Veet GitHub starter code, Durable Objects documentation, TURN service documentation, CLI commands for new Workers and Pages projects, Hopscotch.io for local WebSocket testing, and Cloudflare account signup. The cluster text does not include standalone URLs for every bullet—use the episode pages above as the linked entry points named in this cluster.

  • Joining the wrong room — Multiple testers using different call room ID values never see each other’s signaling; confirm the ID is shared and stable for the session under test.
  • Ignoring closed WebSockets — Episode 4 expects you to handle closed connections; otherwise ghost participants break call setup.
  • WebRTC before signaling — ICE exchange depends on the Durable Object WebSocket path from episodes 3–4; debugging media before signaling works wastes time.
  • Shipping without TURN — As the deploy episode states, firewall scenarios need TURN integration for reliable connections.
  • Confusing this app with SFU or Mesh — Sessions and tracks and Cloudflare Mesh document different connectivity models; they are not step-by-step substitutes for this course.
  1. Read Introduction to the series and What are Durable Objects? so room IDs and object routing match what later episodes assume.

  2. Walk through Create a serverless websocket ‘backend’ and Real-time messaging with WebSockets; confirm your Worker routes WebSockets to the correct Durable Object and that closed sockets are handled.

  3. Follow Build the app frontend and UI until a local video preview works when connecting with a shared call room ID.

  4. Use Make and answer WebRTC calls with two browsers (or two networks) and verify ICE completes and video flows both ways; finish with Deploy your video call app to test disconnect handling, mute/video toggles, and TURN behind a restrictive network.

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page disagrees with the linked Cloudflare documentation or omits an important condition, send the page URL and the exact statement to yimasynthetic@gmail.com so it can be corrected or clarified.