4 ms·
If you are considering protobuf for browser <-> server communication (as opposed to server <-> server) a good alternative is Twirp [1] by twitch. Like gRPC it u
by lf-non 5y ago
If you are considering protobuf for browser <-> server communication (as opposed to server <-> server) a good alternative is Twirp [1] by twitch. Like gRPC it uses protobuf for API schema, but unlike gRPC it works out of the box with HTTP 1 without needing any proxies.
I found both the golang server integration and the typescript client generated to be idiomatic and easy to use. There are community integrations with other languages too - but ymmv.
[1] https://twitchtv.github.io/twirp https://twitchtv.github.io/twirp
- tommiegannert 5y agoJust be aware of the lack of streams: https://github.com/twitchtv/twirp/issues/3 https://github.com/twitchtv/twirp/issues/3
- jenny91 5y agoAny advantages to gRPC-web? We've been using it for a while and it's a bit clunky, but it works. We stick envoy in the middle for gRPC-web <-> gRPC; what do I need for Twirp?
- lf-non 5y agoIt works oob - the browser can directly talk to twirp service. I used it because I basically wanted end-to-end type-safety without any infrastructure overhead and additional decode-encode hops in betweeen.
- jenny91 5y agoAh, but it's not gRPC compatible then; just very similar and uses the same proto syntax for services and messages?
- lf-non 5y agoYes, its an alternative. protobuf is a lower level specification that supports defining typed services. It does not dictate things like transport mechanism or other implementation details. There are multiple protobuf compatible RPC implementations, gRPC obviously being the most popular one, twirp being another.