bwt icon indicating copy to clipboard operation
bwt copied to clipboard

Protobuf + gRPC

Open tiero opened this issue 4 years ago • 1 comments

Just asking here to see if there is some sort of conceptual ACK for starting working on this https://github.com/romanz/electrs/issues/227

It Would be nice if both implementations could expose a gRPC endpoint and the API could be defined by a typed schema.

Why?

  1. gRPC gives HTTP/2 for free
  2. http2 means binary encoding, more efficient than utf8 JSON strings
  3. Protobuf is a perfect match, could give backward and forward compatibility when making changes to the APIs
  4. Server-side streaming
  5. Automatically generate stubs and clients from the single .proto model spec

tiero avatar May 27 '20 20:05 tiero

A gRPC/protobuf interface is something that I'd be willing to accept. It should be put behind a compile-time flag, like the current http/electrum/webhooks flags.

Note that bwt already supports HTTP/2 (via warp/hyper) and already does server-side streaming using Server-Sent Events. The main advantages for me would be protobut instead of json and a more well-defined explicit interface.

I probably won't be prioritizing this myself in the near future, but will gladly review a PR.

shesek avatar May 27 '20 21:05 shesek