Cloudflare Workers and Containers Now Support gRPC and TCP Connections
New capabilities enable low-latency real-time applications.
1New Features for Cloudflare Workers
Cloudflare has added inbound TCP connections and gRPC support to its Workers platform. These features are particularly crucial for real-time voice assistants and low-latency applications. Workers, which has been developed since 2017, can now directly handle TCP sockets coming through Spectrum. The new connect(socket) handler enables developers to achieve full-duplex communication.
2Importance and Use Cases of gRPC
gRPC, developed by Google 10 years ago, is widely used in distributed systems and mobile applications. This HTTP/2-based protocol provides low latency, especially for voice-based AI applications. With Cloudflare's new support, developers can easily deploy gRPC servers written in any language. This leverages the advantages of Cloudflare's network spanning over 330 locations worldwide.
3Full-Duplex Communication Capability
The new features enable bidirectional communication over a single, persistent connection between client and server. The ability to pass sockets to Durable Objects and Containers gives developers complete control. This capability offers significant advantages for real-time voice processing applications. The @cloudflare/voice package in the Cloudflare Agents SDK simplifies such implementations.
4TCP/UDP Support with Spectrum
Cloudflare's Spectrum service acts as an ingress proxy for non-HTTP traffic. With the new update, Spectrum can route incoming TCP connections to specified Workers. This enables using the Cloudflare network for any TCP-based protocol. Developers can now run programs written in any language.
5gRPC-web Conversion and Benefits
Cloudflare automatically converts gRPC-web to standard gRPC, allowing browser-based clients to communicate with gRPC servers. This technology, used since 2020, is now available on Workers. Using Protocol Buffer definition files, developers can create gRPC servers with just a few lines of code.
6Advantages for Mobile Applications
The new features enable mobile apps to reduce network payload by using gRPC. Cloudflare's automatic conversion allows existing gRPC clients to work without modification. These features are currently in private beta, with developers able to sign up for early access. Cloudflare is setting new standards for low-latency applications with these updates.
7Security Features and Integration
Cloudflare converts gRPC traffic to HTTP/1.1 to leverage security features like WAF rules and Bot Management. The open-source @connectrpc/connect package enables developers to easily create gRPC clients. These solutions can be implemented without requiring changes to existing infrastructure.
8Industry Impact and Future Prospects
Cloudflare's updates represent a significant milestone for voice-based AI and real-time applications. Applications requiring low latency can now benefit from Cloudflare's global network. These new capabilities for developers will establish new standards in cloud-based solutions. Wider adoption of these technologies is anticipated in the coming period.