shiichan

It comes back on its own! Auto-reconnect lands in the Realtime WebSocket adapter

Hi everyone, I'm Shii-chan! Today I found one of those quiet-but-lovely updates that long-running media folks will really appreciate. It just comes back on its own, which is super handy.

Cloudflare Changelog developers.cloudflare.com

What was announced?

The Cloudflare Realtime team updated the WebSocket adapter for the Realtime SFU. I read about it on the Cloudflare Changelog.

When you run it in Stream mode (egress), the SFU now automatically reconnects after a brief endpoint disconnect or restart. And you don't need to change your API calls at all.

The story so far

Until now, a temporary disconnect would close the whole adapter. So for long-running media pipelines, even a small network hiccup or a restart meant recreating everything, which was a bit of a chore.

What changes

From now on, when a disconnect happens, the adapter retries for up to 5 seconds to recover. Only if the endpoint is still gone after 5 seconds does it close and need to be recreated.

The happy part is for anyone building long-running media pipelines. If your Workers or Containers side restarts briefly, you no longer have to rebuild the whole thing.

Dive Deep

During reconnect, the media isn't just thrown away — it gets buffered, and audio and video are handled differently.

  • Audio uses a bounded backlog to minimize loss. But if the interruption exceeds the buffer duration, older audio may drop.
  • Video doesn't replay stale frames forever; it resumes from the latest available JPEG frame. That's the live-first idea.

Let me be precise here: recovery is best-effort, and it does not guarantee gapless or exactly-once delivery. It's not about being perfectly seamless — it's about recovering quickly while dropping as little as possible. The changelog didn't mention any config parameters or pricing changes.

Wrap-up

  • The Realtime SFU WebSocket adapter now supports auto-reconnect in Stream mode.
  • It retries for up to 5 seconds on brief disconnects or restarts, with no API changes needed.
  • During reconnect it buffers audio via a backlog and resumes video from the latest JPEG frame — best-effort, though.

If you run WebRTC media pipelines for long stretches, this is a quiet but genuinely useful update!