Cloudflare Calls was released to let developers build real-time audio/video apps.
It exposes a set of APIs to allow them to build things like a video conferencing app with a custom UI, an interactive conversation where moderators can invite select audience members on stage, or even private group workout apps.
It uses the peer-to-peer protocol WebRTC that enables two or more devices to talk to each other directly and without leaving the browser. The native implementation works especially well for one to one calls that have only two participants, and reliability issues such as video freezes and participants getting out of sync may arise when there are additional participants.
This is fixed through a selective forwarding unity (SFU) that connects users with each other in real-time apps by intelligently managing and routing video and audio data between participants. Apps that use this reduce the data capacity required from each user because they don’t have to send data to every other user.
However, the centralized nature of an SFU means that it will be slow in most parts of the work while only being fast in a few regions. It also requires a lot of DevOps overhead to manually configure regions and scalability.
“Calls does not use the traditional SFU topology where every participant connects to a centralized server in a single location. Instead, each participant connects to their local Cloudflare data center. When another participant wants to retrieve that media, the datacenter that homes that original media stream is found and the tracks are forwarded between datacenters automatically. If two participants are physically close their media does not travel around the world to a centralized region, instead they use the same datacenter, greatly reducing latency and improving reliability,” Zaid Farooqi, senior product manager, and Renan Dincer, systems engineer at Cloudflare, wrote in a blog post. “Calls is a configurable, global, regionless WebRTC server that is the size of Cloudflare’s ever-growing network.”
Calls implements the WebRTC RTCPeerConnection API across the Cloudflare Network where users can push media tracks and also exposes an API where other media tracks can be requested with the same Peer Connection context.
According to the blog post, Cloudflare Calls is a good solution if one operates their own WebRTC server such as Janus or MediaSoup. Calls also uses anycast for every connection so that packets are always routed to the closest Cloudflare location and users are automatically served from a location close to them.
From a security standpoint, Cloudflare Calls eliminates the need for participants to share their IP address with each other and all video and audio traffic that passes through is encrypted by default.
Cloudflare Calls is being released in closed beta today and will be free during the beta period