cloudflare

Cloudflare Workers and Containers now support inbound TCP connections and gRPC (opens in new tab)

Cloudflare is expanding Workers to support low-latency, TCP-based applications such as real-time voice AI and gRPC services. New inbound socket handling lets Workers route connections through Durable Objects and Containers, while Cloudflare also enables full-duplex gRPC servers running in containers. Together, these capabilities allow developers to deploy language-agnostic TCP and gRPC services closer to users across Cloudflare’s global network.

Inbound TCP with connect(socket)

  • Workers can now accept inbound TCP sockets through a new connect() handler.
  • The socket exposes readable and writable streams, allowing Workers to send, receive, and proxy raw bytes.
  • Connections can be routed:
    • Between Workers
    • From Workers to Durable Objects
    • From Durable Objects to Cloudflare Containers
  • Developers can pipe data in both directions to preserve full-duplex communication.
  • Containers can run arbitrary TCP servers written in any language, such as Python services listening on port 8080.
  • Cloudflare Spectrum provides the TCP ingress layer and routes incoming connections to the selected Worker.

Full-Duplex gRPC in Containers

  • Developers can deploy gRPC servers written in languages such as Go inside Cloudflare Containers.
  • Bidirectional streaming allows clients and servers to exchange messages over one persistent connection.
  • This is particularly useful for:
    • Real-time voice AI
    • Low-latency inference
    • Mobile and distributed applications
    • Streaming RPC workflows
  • A sample Go server sends an initial connection message, echoes incoming messages, and sends a closing message when the client disconnects.
  • Cloudflare’s network of more than 330 locations can bring gRPC workloads closer to users, reducing latency.

gRPC APIs from Workers

  • Workers can serve unary and server-streaming gRPC APIs.
  • Workers can also call external gRPC servers.
  • Developers write the application using gRPC-Web, while Cloudflare automatically converts incoming and outgoing requests to standard gRPC.
  • This provides a simpler integration path for applications that need gRPC without managing raw protocol translation themselves.

Availability

  • The features are being introduced through a private beta.
  • Interested developers must sign up to gain access.

Cloudflare recommends these capabilities for applications requiring persistent, low-latency, bidirectional communication. The combination of Spectrum, Workers, Durable Objects, and Containers provides a flexible path for running raw TCP protocols and gRPC services close to end users.