DEV Community

John Davis
John Davis

Posted on Edited on

Connect from the browser, without the fetch compromise — grpc-over-datachannels 0.50

Connect's browser story has a hard edge: fetch can't stream request bodies portably, so client and bidirectional streaming from the browser stay stuck (connect-es#669 is the long-running thread). 0.50 of grpc-over-datachannels ships the answer we built for it: the Connect protocol carried over a WebRTC DataChannel, with Buf's own implementations as the compatibility bar.

The shape. One Rust implementation, dc-connect, owns the Connect envelope codec, stream multiplexing, and status mapping. On top of it:

  • connect-gateway — a Rust gateway that terminates Connect-over-DataChannel and forwards to an untouched Connect HTTP backend. Your connect-go/connect-es handlers don't change; unary rides HTTP/2 (h2c) unframed, streaming rides it enveloped, client metadata is forwarded, and response headers/trailers are surfaced back to the client.
  • Generated transports and shims — a Connect-ES transport for browsers (grpc-dc/connectmux), an in-process bridge that feeds Connect-style handlers with no HTTP at all (browser-to-browser included), and mux shims generated from Racket templates for all sixteen languages, every one tested against the Rust core.
  • dc-connect itself, if you want the protocol in-process (Rust crate, C ABI, Wasm).

The compatibility bar. We didn't grade our own homework. The test that matters is a differential harness: the same connect-es client code runs twice against the same Eliza backend — once over the official HTTP/2 transport, once over the data-channel gateway — and must produce identical messages, errors, headers, trailers, and forwarded metadata. It runs against both Buf backends (connect-go and connect-es servers), and the generated per-language parity suite (reset mid-stream, error details, >64 KiB frames, concurrent streams, close-without-end) is generated from one Racket scenario spec into sixteen test trees.

Naming, de-confused. There are three artifacts and CONNECT.md opens with which one you need: protocol in-process → dc-connect; Connect client over a data channel → connect-dc; existing Connect server + browser/peer clients → connect-gateway in front of it. Separate repos (browser-grpc/dc-connect, browser-grpc/connect-gateway), separate packages (dc-connect crates, connect-dc on npm/PyPI), boundary gates in the generator so they can't re-merge by accident.

If you've been waiting on browser bidi for Connect: it's here, it's boring on purpose, and the handlers you already wrote are the ones that serve it.

Watch: the 2-minute video · the 45-second Short

Top comments (0)