shiichan

Realtime SFU WebSocket Adapter Is GA: Send Call Audio and Video Straight to Your Server

Hi, it's Shii-chan! Today I found an update from Cloudflare Realtime that makes live calls much easier to work with. I'm so excited!

Cloudflare Changelog developers.cloudflare.com

What was announced?

In the Cloudflare Changelog, the WebSocket adapter for Realtime SFU is now generally available (GA).

The SFU (selective forwarding unit) is managed WebRTC infrastructure for live audio, video, and data, running across Cloudflare's global network in 330+ cities. The WebSocket adapter connects a live call to any server that accepts WebSockets, such as a Durable Object.

The media arrives in these two formats:

  • Uncompressed PCM audio
  • JPEG video frames

So your backend can process media without implementing a WebRTC client.

Why it matters

WebRTC is great for the call itself, but analyzing audio or video on the server used to mean building your own WebRTC client. With this adapter, your server just receives PCM and JPEG over a normal WebSocket. That pairs nicely with AI transcription and image analysis!

What changes

Here are the use cases the original post mentions.

  • Transcribe or record call audio, or let a voice agent hear and respond to participants
  • Analyze images or build previews from live video

Here is what it means for existing integrations.

  • Adapter creation requests and media formats stay the same
  • For WebRTC-to-WebSocket streaming, the SFU now automatically retries the same endpoint for up to 15 seconds instead of 5, with no extra API setting
  • The close API is now idempotent and returns success even if the adapter has already closed

Dive Deep

Two examples are introduced.

  • AI audio example: uses Durable Objects and Workers AI for transcription and speech generation. Separate adapters receive PCM audio and send generated speech back to participants
  • WebRTC-to-JPEG example: sends a browser's camera stream to a Durable Object as JPEG frames, at one frame per second by default

The close API request specifies an adapterId, like this:

{ "tracks": [{ "adapterId": "{ADAPTER_ID}" }] }

Setup, media formats, and API requests are covered in the WebSocket adapter guide.

Wrap-up

  • The Realtime SFU WebSocket adapter is GA
  • PCM audio and JPEG video frames reach your WebSocket server without a WebRTC client
  • Retries now last up to 15 seconds, and the close API is idempotent
  • Existing creation requests and media formats are unchanged

This one is for anyone who wants to add AI transcription or voice agents to live calls!