Menu

gRPC in the browser without grpc-web: the wire protocol over a WebRTC DataChannel
📰

gRPC in the browser without grpc-web: the wire protocol over a WebRTC DataChannel

DEV Community: rust·John Davis·17 days ago
#FbeIcDj6
#devtorust#devto#dev#grpc#kafka
Reading 0:00
15s threshold

grpc-web exists because browsers can't speak HTTP/2 trailers.

The usual answer is a translation proxy in front of your service.

We took a different one: run the actual gRPC wire protocol —

length-prefixed frames, HPACK-free, all four call shapes — over a

single WebRTC RTCDataChannel , and generate the runtime for it

from your .proto .

grpc-over-datachannels is that experiment, grown up:

Dependency-free generated runtimes for 16 languages — JavaScript/TypeScript, Go, Rust, Python, Ruby, PHP, Lua, C, C++, Dart, Java, Kotlin, Scala, Swift, C#, and Zig. Browser and native. The generated code is stdlib-only; there is no grpc library underneath it.

Our own WebRTC stack. ICE, DTLS, and SCTP written from scratch, so the native clients don't depend on a WebRTC library either.

Graded against stock gRPC. The generated implementations are tested against the reference implementations through a TCP↔DataChannel proxy — the oracle is the real thing, not a reimplementation of it.

WebRTC-Direct.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.