dialohq / ocaml-grpc

gRPC library for OCaml
https://dialohq.github.io/ocaml-grpc
BSD 3-Clause "New" or "Revised" License
62 stars 9 forks source link

Provide opinionated cruft around client side connection and stream management #3

Open wokalski opened 2 years ago

wokalski commented 2 years ago

Currently we have this fluff all around the example.

There are two possible solutions:

  1. Simply put that logic in the Connection module in grpc-lwt (and in grpc-async respectively)
  2. Develop a more robust solution implementing grpc channels, excerpt from the docs:

    Channels are a key concept in gRPC. Streams in HTTP/2 enable multiple concurrent conversations on a single connection; channels extend this concept by enabling multiple streams over multiple concurrent connections. On the surface, channels provide an easy interface for users to send messages into; underneath the hood, though, an incredible amount of engineering goes into keeping these connections alive, healthy, and utilized.

    More about channels:

quernd commented 2 years ago

I think we should aim to provide more robust support for channels (option 2). This includes implementing the state machine as well as retries with exponential backoff. We can also handle lifecycle management of the connection here as per our recent discussion.