Menu
Cloudflare Blog·August 3, 2026

Cloudflare Workers for Bidirectional gRPC and Inbound TCP

Cloudflare has enhanced its Workers platform to support inbound TCP connections and full-duplex, bidirectional gRPC, enabling developers to build low-latency, real-time applications directly on their edge network. This significant update allows Workers to act as gRPC servers or clients, with automatic gRPC to gRPC-web translation, and facilitates routing raw TCP sockets to Workers, Durable Objects, or backend containers. The architectural evolution focuses on expanding Workers' utility beyond HTTP, supporting diverse protocols and demanding AI/voice applications closer to users.

Read original on Cloudflare Blog

Cloudflare's latest enhancements to its Workers platform introduce critical capabilities for building high-performance, real-time applications at the edge. By enabling inbound TCP connections and full bidirectional gRPC support, Cloudflare is extending the Workers' utility beyond traditional HTTP-based workloads. This is particularly relevant for modern applications like AI-powered voice assistants and distributed systems requiring low-latency, persistent connections.

Inbound TCP Connections via `connect(socket)` Handler

The core of this update is the new `connect(socket)` handler in the Workers runtime. This handler allows a Worker to directly accept an inbound TCP socket provided by Cloudflare Spectrum, their ingress proxy for non-HTTP traffic. This architectural choice gives developers granular control over how non-HTTP connections are routed and processed at the edge.

💡

Socket Routing Flexibility

A key architectural advantage is the ability to pass the accepted TCP socket from one Worker to another Worker, or from a Worker to a Durable Object, and even from a Durable Object to a backend container. This enables complex routing logic and stateful, long-lived connections managed across different components within the Cloudflare ecosystem.

Bidirectional gRPC Support

While Workers previously supported outbound TCP and Cap'n Proto RPC, the addition of full-duplex, bidirectional gRPC is a major step. This allows for deploying gRPC servers in any language to Cloudflare Containers, leveraging Cloudflare's global network to place services closer to users. For simpler use cases, Workers can directly serve unary and server-streaming gRPC APIs and act as gRPC clients, utilizing automatic gRPC to gRPC-web conversion.

The gRPC to gRPC-web translation is a crucial architectural detail. Since web browsers do not expose the low-level HTTP/2 features required by native gRPC (like stream-level control for multiplexing, cancellation, and flow control), Cloudflare's edge automatically handles this conversion. This allows developers to use gRPC-web compatible code in Workers, while external clients and servers communicate using standard gRPC, without requiring any changes to their existing implementations. This conversion also enables Cloudflare's security features, like WAF and Bot Management, to inspect and protect gRPC traffic.

  • For Mobile Apps: Build gRPC backends for mobile apps on Workers, leveraging efficient data serialization and strongly-typed client libraries without needing to change existing mobile gRPC implementations.
  • For Existing Backends: Place a Worker in front of an existing gRPC backend to move performance-critical logic or state closer to the user, similar to how Workers are used with REST APIs.
Cloudflare WorkersgRPCTCPEdge ComputingReal-time CommunicationDistributed SystemsServerlessAPI Gateway

Comments

Loading comments...