Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Cloudflare platform skill covering Workers, D1, R2, KV, AI, Durable Objects, and security.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/realtime-sfu/README.md
1# Cloudflare Realtime SFU Reference23Expert guidance for building real-time audio/video/data applications using Cloudflare Realtime SFU (Selective Forwarding Unit).45## Reading Order67| Task | Files | ~Tokens |8|------|-------|---------|9| New project | README → configuration | ~1200 |10| Implement publish/subscribe | README → api | ~1600 |11| Add PartyTracks | patterns (PartyTracks section) | ~800 |12| Build presence system | patterns (DO section) | ~800 |13| Debug connection issues | gotchas | ~700 |14| Scale to millions | patterns (Cascading section) | ~600 |15| Add simulcast | patterns (Advanced section) | ~500 |16| Configure TURN | configuration (TURN section) | ~400 |1718## In This Reference1920- **[configuration.md](configuration.md)** - Setup, deployment, environment variables, Wrangler config21- **[api.md](api.md)** - Sessions, tracks, endpoints, request/response patterns22- **[patterns.md](patterns.md)** - Architecture patterns, use cases, integration examples23- **[gotchas.md](gotchas.md)** - Common issues, debugging, performance, security2425## Quick Start2627Cloudflare Realtime SFU: WebRTC infrastructure on global network (310+ cities). Anycast routing, no regional constraints, pub/sub model.2829**Core concepts:**30- **Sessions:** WebRTC PeerConnection to Cloudflare edge31- **Tracks:** Audio/video/data channels you publish or subscribe to32- **No rooms:** Build presence layer yourself via track sharing (see patterns.md)3334**Mental model:** Your client establishes one WebRTC session, publishes tracks (audio/video), shares track IDs via your backend, others subscribe to your tracks using track IDs + your session ID.3536## Choose Your Approach3738| Approach | When to Use | Complexity |39|----------|-------------|------------|40| **PartyTracks** | Production apps with device switching, React | Low - Observable-based, handles reconnections |41| **Raw API** | Custom requirements, non-browser, learning | Medium - Full control, manual WebRTC lifecycle |42| **RealtimeKit** | End-to-end SDK with UI components | Lowest - Managed state, React hooks |4344**Recommendation:** Start with PartyTracks for most production applications. See patterns.md for PartyTracks examples.4546## SFU vs RealtimeKit4748- **Realtime SFU:** WebRTC infrastructure (this reference). Build your own signaling, presence, UI.49- **RealtimeKit:** SDK layer on top of SFU. Includes React hooks, state management, UI components. Part of Cloudflare AI platform.5051Use SFU directly when you need custom signaling or non-React framework. Use RealtimeKit for faster development with React.5253## Setup5455Dashboard: https://dash.cloudflare.com/?to=/:account/calls5657Get `CALLS_APP_ID` and `CALLS_APP_SECRET` from dashboard, then see configuration.md for deployment.5859## See Also6061- [Orange Meets Demo](https://demo.orange.cloudflare.dev/)62- [Orange Source](https://github.com/cloudflare/orange)63- [Calls Examples](https://github.com/cloudflare/calls-examples)64- [API Reference](https://developers.cloudflare.com/api/resources/calls/)65- [RealtimeKit Docs](https://developers.cloudflare.com/workers-ai/realtimekit/)66