Skip to content
InfoQ·

💻Cloudflare Workers Now Accept Inbound TCP Connections

Your API Gateway Just Got A Whole Lot Smarter

TL;DR

Cloudflare Workers can now accept inbound TCP connections, enabling full-duplex communication and routing logic in JavaScript. This opens up new possibilities for API gateways and serverless architectures.

Cloudflare Workers can now accept inbound TCP connections, a game-changer for serverless architectures. This means you can route and manipulate TCP traffic directly from Workers, making them more versatile for API gateways and microservices. The new connect(socket) handler allows Workers to read and write sockets, pass them to other Workers or Durable Objects, and even forward them to Containers. This is a big deal for teams running complex microservices or API gateways, as it simplifies TCP traffic management and reduces latency. Cloudflare's examples include unmodified Go and Python gRPC servers, showing the flexibility of the new feature.

Cloudflare Workers Now Accept Inbound TCP Connections — InfoQ

Key Points

1

Cloudflare announced inbound TCP support during Agents Week, focusing on voice AI and low latency.

2

The connect(socket) handler accepts raw inbound sockets, routed to Workers through Spectrum.

3

Workers can serve unary and server-streaming gRPC, but full-duplex streams require a container.

4

Existing clients need no changes, as Workers can serve mobile apps using grpc-swift-2 or grpc-kotlin.

5

Cloudflare will work with gRPC developers first to ensure implementation is right before full rollout.

Why It Matters

If you're running a complex API gateway or microservices architecture, Cloudflare's new inbound TCP support in Workers can simplify traffic management and reduce latency. This is especially useful for teams using gRPC or other TCP-based protocols, as it allows for direct manipulation of TCP traffic in JavaScript before forwarding to backend services. However, the full-duplex constraint means some advanced gRPC features still require a container, so plan accordingly.

cloudflareworkerstcpapi-gatewaymicroservices

Frequently Asked Questions

Why does this matter?

If you're running a complex API gateway or microservices architecture, Cloudflare's new inbound TCP support in Workers can simplify traffic management and reduce latency. This is especially useful for teams using gRPC or other TCP-based protocols, as it allows for direct manipulation of TCP traffic in JavaScript before forwarding to backend services. However, the full-duplex constraint means some advanced gRPC features still require a container, so plan accordingly.

What happened?

Cloudflare Workers can now accept inbound TCP connections, enabling full-duplex communication and routing logic in JavaScript. This opens up new possibilities for API gateways and serverless architectures.

Comments

Subscribe to join the conversation...

Be the first to comment

Enjoyed this article?

Get it daily. 7am. Free. Reads in 5 minutes.

Join 3,382 builders reading daily.

Also get