Cloudflare Workers and Containers Add Support for Inbound TCP and gRPC Connections

Cloudflare has expanded the capabilities of its edge development platform by introducing support for inbound TCP connections and gRPC traffic. This update allows Cloudflare Workers and Containers to receive direct socket connections via Cloudflare Spectrum, routing them seamlessly to Durable Objects and back-end services. Developers can now implement real-time, bidirectional communication protocols without needing complex intermediary proxy setups.
Primary source
Open Cloudflare Blog ↗This article summarizes the source. Check the original for full details and conditions.
Comparison
| Aspect | Before / Alternative | After / This |
|---|---|---|
| Protocol support | Inbound connections were restricted to HTTP and HTTPS protocols | Supports direct inbound TCP socket connections and native gRPC |
| Traffic routing | Required manual conversion or proxying of non-HTTP traffic at the edge | Direct socket forwarding to Durable Objects and Containers via Cloudflare Spectrum |
| Client compatibility | Clients were forced to use HTTP-based APIs or gRPC-Web workarounds | Full-duplex gRPC connections and automatic gRPC-to-gRPC-web translation |
Action Checklist
- Enable Cloudflare Spectrum for your target hostnames to accept inbound TCP traffic Verify that your plan has Spectrum enabled before configuring routes
- Configure routing rules to forward inbound TCP sockets directly to Durable Objects or Containers Update wrangler.toml or your deployment configuration to handle incoming raw socket streams
- Implement gRPC handlers inside your Cloudflare Workers to process bidirectional RPC calls Test client connections to verify that automatic translation behaves as expected with your schemas