Inbound TCP + gRPC · public beta

Real gRPC.
Into a Worker.
No HTTP shim.

grpc.jilles.fyi:50051 is a public gRPC endpoint that is all Cloudflare. A raw TCP connection comes in at the edge, goes through a Worker's connect() handler and a Durable Object, and ends at a normal gRPC server running in a Container. Same TLS bytes, same HTTP/2 framing, and full bidirectional streams, from the client all the way to your code.

● Spectrum → Worker ● Worker.connect() ● Durable Object ● Container :50051 ● TLS end-to-end
$ npm run tui -- --grpc grpc.jilles.fyi:50051 --http https://grpc-vs-http.<subdomain>.workers.dev
# press w to warm up, then 1 · 2 · 3 to race, or a to run all three
✓ gRPC · 1 TLS socket · HTTP/2 multiplexed · protobuf
✓ HTTP · fetch() · JSON · one request per message
01 · What it is

Two protocols, one backend, side by side.

The demo is a race. Both lanes call the same Worker, the same Durable Object and the same Container, which runs identical business logic and checksum work on both ports. Any difference you see comes from the protocol and transport, not from the backend.

[1] UNARY BURST

200 RPCs, concurrency 10

gRPC sends everything over one persistent, multiplexed HTTP/2 socket with protobuf. HTTP sends 200 separate JSON POSTs.

[2] BIDI STREAM

150 × 2 KB frames

A single full-duplex gRPC stream, where frames and acks flow both ways at once, against HTTP POSTs carrying the same frames base64-encoded, one at a time.

[3] PAYLOAD

2,400 structured records

30 batches of 80 telemetry events. Protobuf binary against UTF-8 JSON, comparing bytes on the wire and serialization cost.

02 · How it works

Follow a byte through the stack.

Click any hop to see the code that runs there. On the gRPC lane, Cloudflare passes opaque TLS bytes through. Only the Container, your gRPC server, ever decrypts them.

gRPC
ClientTLS · HTTP/2
Spectrumtcp/50051
Workerconnect()
Durable Objectconnect()
Containergrpc-js :50051
HTTP
ClientHTTPS
EdgeHTTP proxy
Workerfetch()
Durable Objectfetch()
Containernode:http :8080
↑ click a hop
03 · The difference

A socket isn't a request.

Until now, everything that reached a Worker was an HTTP request. A connect() handler gets a raw, long-lived, two-way byte stream instead. That one change is what lets a real gRPC server work behind Cloudflare.

gRPC · Inbound TCP
HTTP · fetch()
Unit of workA TCP socket that stays open for many RPCs
Unit of workOne request, then one response
ConcurrencyHTTP/2 streams multiplexed on one connection
ConcurrencyA separate request for every message
DirectionFull duplex: client and server write whenever they want
DirectionThe client asks and the server answers
EncodingProtobuf: typed, compact binary, bytes sent as-is
EncodingJSON: text, with binary data base64-encoded (+33%)
TLSTerminated in your Container, using your cert from Secrets Store
TLSTerminated at the Cloudflare edge
Contractarena.proto, with clients generated for any language
ContractWhatever the JSON happens to contain
04 · Full duplex, visualized

One stream, both directions, at once.

This is race [2] in slow motion. Each square is a 2 KB frame. On the left, gRPC keeps sending while acks are still coming back on the same stream. On the right, every frame has to wait for the previous round trip to finish.

gRPC BiDiStream · 1 HTTP/2 stream
0 / 150 frames acked
HTTP · sequential POST /api/stream-frame
0 / 150 frames acked

Illustration only: in-flight window and RTT are simulated. Run the TUI for real numbers.

05 · What goes on the wire

The same event, two encodings.

This is the actual TelemetryEvent from the demo. JSON repeats every field name in every message and turns the 256-byte binary sample into base64 text. Protobuf sends a small numeric tag for each field and the raw bytes.

JSON (measured)
–
Protobuf (est.)
–

The JSON size is measured live in your browser. The protobuf size is a field-by-field estimate (tag + length + value) for the same message, before HTTP/2 framing and compression.


        
message TelemetryEvent {
  uint32 seq           = 1;
  string device_id     = 2;
  string region        = 3;
  int64  timestamp_ms  = 4;
  double cpu_pct       = 5;
  double mem_mb        = 6;
  uint32 rps           = 7;
  string status        = 8;
  repeated string tags = 9;
  bytes  sample_bytes  = 10;  // raw, no base64
}
06 · Why it's a big deal

Cloudflare is no longer HTTP-only.

The Workers platform has always started with a Request. With Inbound TCP, it can start with a socket instead. That brings a whole category of workloads to the platform that used to need a VM and a load balancer.

  • Bring your existing gRPC servicesUse any language and any grpc server, with your current .proto files. Put it in a Container and your existing clients can talk to it without changes.
  • Real bidirectional streamingVoice agents, live telemetry, multiplayer state, and LLM token streams in both directions, without falling back to WebSockets or long-polling.
  • You still have programmable controlEvery connection runs through your Worker first, so you can authenticate, route, shard by Durable Object, or rate-limit before a single byte reaches the Container.
  • Stateful routing for freegetByName() pins a connection to one Durable Object and its Container. That gives you per-tenant or per-session backends with no service discovery.
  • End-to-end encryptionSpectrum, the Worker and the DO only forward ciphertext. The TLS key lives in Secrets Store and is only used inside your Container.
  • Any TCP protocol, not just gRPCgRPC is the headline, but this same pipeline works for databases, MQTT, game servers, SSH-style tools, or your own custom binary protocol.