This module is designed to help processess maintain update subscriptions that will automatically recover from lost connections. It exposes to the client when the subscription has been lost or recovered, so the client can choose how to handle a lost connection.
module Update : sig ... end
val create : Async_rpc_kernel.Rpc.Connection.t Async_durable__.Durable.t ‑> ('query, 'response, 'error) Async_rpc_kernel.Rpc.Pipe_rpc.t ‑> query:'query ‑> resubscribe_delay:Core_kernel.Time.Span.t ‑> ('response, 'error) Update.t Async_kernel.Pipe.Reader.t
create
will immediately dispatch the the supplied Rpc.Pipe_rpc.t
with query
over
the Rpc.Connection.t Async_durable.t
. If a connection attempt fails or if the subscription
closes, it waits resubscribe_delay
and dispatches again to create a new subscription.
The pipe returned by create
contains all the responses that come over the internal
subscription, as well as updates about the state of the t
.
Closing the returned pipe will permanently close the subscription.
val create_or_fail : Async_rpc_kernel.Rpc.Connection.t Async_durable__.Durable.t ‑> ('query, 'response, 'error) Async_rpc_kernel.Rpc.Pipe_rpc.t ‑> query:'query ‑> resubscribe_delay:Core_kernel.Time.Span.t ‑> (('response, 'error) Update.t Async_kernel.Pipe.Reader.t, 'error) Core_kernel.Result.t Core_kernel.Or_error.t Async_kernel.Deferred.t
create_or_fail
will return an Error e
if the initial attempt to dispatch the
supplied Rpc.Pipe_rpc.t
does not succeed, or an Ok (Error 'error)
if the initial
dispatch returns a server side rpc error.