Live
Cloudflare Images Analytics Dashboard Adds 30‑Day Delivery VisibilityAmazon ECS Adds Native Blue/Green, Canary, and Linear Deployments for Safer Container RolloutsGemini agentic tools add LLM‑driven automation to Partner Marketing StudioGitHub Actions makes RHEL 9/10 runner images generally available for larger workloadsIntegrating Decider Models to Reduce Latency and Cost in AI Agent WorkflowsAWS Emulator Enables Local Testing of 200+ Services, but Lacks IAM ValidationSageMaker AI monitoring adds automatic latency drift, idle GPU, and configuration gap detection for inference endpointsEmbedding Proactive Governance into Enterprise‑Scale Agentic AICloudflare Images Analytics Dashboard Adds 30‑Day Delivery VisibilityAmazon ECS Adds Native Blue/Green, Canary, and Linear Deployments for Safer Container RolloutsGemini agentic tools add LLM‑driven automation to Partner Marketing StudioGitHub Actions makes RHEL 9/10 runner images generally available for larger workloadsIntegrating Decider Models to Reduce Latency and Cost in AI Agent WorkflowsAWS Emulator Enables Local Testing of 200+ Services, but Lacks IAM ValidationSageMaker AI monitoring adds automatic latency drift, idle GPU, and configuration gap detection for inference endpointsEmbedding Proactive Governance into Enterprise‑Scale Agentic AI
Cloudflare

Public beta adds inbound TCP to Workers and gRPC support for Containers

AI SummaryPowered by AI

Cloudflare now offers public‑beta inbound TCP handling for Workers and bidirectional gRPC for Containers. This expands the edge surface for custom protocols, letting engineers forward raw sockets through Workers to Durable Objects or Container services.

Cloudflare has opened public beta for inbound TCP connections to Workers and for bidirectional gRPC traffic in Containers. The change lets a TCP client reach a Worker’s connect() handler, which can then pipe the stream to a Durable Object or a Container‑hosted gRPC server. Engineers who need custom protocol handling at the edge now have a native, low‑latency path without resorting to external proxies.

New capabilities at a glance

  • Worker‑origin Spectrum applications are enabled on Pro and Business zones, and on Enterprise zones when Spectrum Enterprise is turned on.
  • Without Spectrum Enterprise, a zone can host a single Worker‑origin application on a single TCP port.
  • Workers receive raw TCP sockets via the connect() event and can forward them to a Durable Object using DurableObjectNamespace.getByName(...).connect().
  • Containers can expose a gRPC or generic TCP server that receives traffic from the same Spectrum entry point.

Wiring a Worker to a Durable Object

The typical pattern is to accept the inbound socket, open a connection to a Durable Object that represents the target Container, and pipe data in both directions. The following JavaScript snippet shows the essential steps:

export default {
  async connect(socket, env) {
    const container = env.GRPC_CONTAINER.getByName("grpc-demo");
    const doSocket = container.connect("grpc-container:50051", {
      allowHalfOpen: true,
      secureTransport: "off",
    });
    try {
      await doSocket.opened;
      await Promise.all([
        socket.readable.pipeTo(doSocket.writable),
        doSocket.readable.pipeTo(socket.writable),
      ]);
    } finally {
      await Promise.allSettled([socket.close(), doSocket.close()]);
    }
  },
};

Key points in the code are the explicit half‑open allowance (required for bidirectional streams) and the disabling of secure transport, which matches the raw TCP nature of the inbound connection.

Operational and security considerations

  • Port allocation: Each Pro or Business zone supports only one TCP port for a Worker‑origin application unless Spectrum Enterprise is enabled. Plan port usage accordingly.
  • Zone limits: The beta is limited to zones with the appropriate Spectrum tier. Verify that your deployment target matches the required tier.
  • Durable Object lifecycle: The Worker creates a socket to a Durable Object instance on demand. Ensure the Durable Object class can handle rapid connection churn without exhausting resources.
  • Transport security: The example disables secure transport. If the downstream Container expects TLS, you must terminate TLS inside the Container or adjust the connection options.
  • Observability: Both the Worker and the Durable Object expose standard stream events. Instrument read/write errors and connection closures to detect abnormal traffic patterns.

Related CloudNinjas coverage: hands-on guides.

What This Means For Practitioners

Practitioners can now expose custom TCP or gRPC services directly at the edge, reducing latency and simplifying architecture by removing intermediate load balancers. Evaluate whether your existing edge logic can be migrated to a Worker‑origin model, and assess port and tier constraints before scaling. Monitor connection health and resource usage in both Workers and Durable Objects to avoid unexpected throttling. The beta provides a concrete path to edge‑native protocol handling; plan proof‑of‑concept deployments to validate performance and operational fit.

Originally published atCloudflare Developer Platform