package bonsai
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=1d68aab713659951eba5b85f21d6f9382e0efa8579a02c3be65d9071c6e86303
doc/bonsai.web/Bonsai_web/Rpc_effect/Shared_poller/index.html
Module Rpc_effect.Shared_poller
Source
A Shared_poller
is a handle to a polling-style RPC whose RPCs can be shared between multiple components that might have an interest in polling values with the same types.
To create a Shared_poller
, use either Rpc_effect.Rpc.shared_poller
or Rpc_effect.Polling_state_rpc.shared_poller
. With the value returned by those functions, you can call Shared_poller.lookup
with a query value to get access to the results of the given RPC with the provided query.
val lookup :
(module Bonsai.Model with type t = 'query) ->
('query, 'response) t Bonsai.Value.t ->
'query Bonsai.Value.t ->
('query, 'response) Poll_result.t Bonsai.Computation.t
Uses a shared-poller to either start polling an RPC, or if another user of the same shared-poller is already polling with the same query, it'll immediately return the most recent value.
val custom_create :
('query, _) Bonsai.comparator ->
f:
('query Bonsai.For_open.Value.t ->
('query, 'response) Poll_result.t Bonsai.For_open.Computation.t) ->
('query, 'response) t Bonsai.For_open.Computation.t
You can use custom_create
to build a shared-poller if the Rpc_effect.Rpc.shared_poller
and Rpc_effect.Polling_state_rpc.shared_poller
aren't sufficient.