Realtime - Cloudflare's Realtime WebSocket adapter now auto-reconnects and buffers WebRTC media
Key Points
- Automatic 5s WebSocket retry
- Audio and video buffered during brief disconnects
- No API change; adapter closes after 5s if endpoint stays down
Summary
Cloudflare Realtime SFU's WebSocket adapter (Stream/egress mode) now automatically retries a disconnected WebSocket endpoint for up to 5 seconds and buffers live WebRTC media so audio and video can resume without your application having to recreate the adapter. No API changes are required.
Key Points
- Auto-reconnect: the SFU retries the same WebSocket endpoint for up to 5 seconds after brief disconnects or endpoint restarts.
- No API change: the adapter will automatically attempt reconnection; if the endpoint remains unavailable after 5 seconds the adapter closes and must be recreated by your app.
- Audio buffering: uses a short bounded backlog to reduce audible loss; older audio may be dropped if interruption exceeds the backlog.
- Video buffering: uses live-first buffering and resumes from the latest JPEG frame instead of replaying stale frames.
- Payloads: adapter streams PCM audio frames and JPEG video frames to standard WebSocket endpoints (useful for transcription, recording, and media processing pipelines).
Recommendations for engineers
- Ensure backend endpoints restart quickly (<5s) or implement logic to recreate the adapter if needed.
- Make downstream processing idempotent and tolerant of dropped audio frames or frame gaps.
- Monitor adapter lifecycle and reconnect events to surface long interruptions that exceed the 5s window.