package bonsai
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c78c4476ee6b856846e2d0941e5965009d5e1b853e564b2b1bee61202f0b1ebb
doc/bonsai.web/Bonsai_web/Rpc_effect/Shared_poller/index.html
Module Rpc_effect.Shared_pollerSource
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 :
?sexp_of_model:('query -> Core.Sexp.t) ->
equal:('query -> 'query -> bool) ->
('query, 'response) t Bonsai.Value.t ->
'query Bonsai.Value.t ->
('query, 'response) Poll_result.t Bonsai.Computation.tUses 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.tYou 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.