Mina_net2.Pubsubval subscribe :
t ->
string ->
handle_and_validate_incoming_message:
( string Network_peer.Envelope.Incoming.t ->
Validation_callback.t ->
unit Async.Deferred.t ) ->
string subscription Async.Deferred.Or_error.tSubscribe to a pubsub topic. * * Fails if already subscribed. If it succeeds, incoming messages for that * topic will be written to the Subscription.message_pipe t. Returned deferred * is resolved with Ok sub as soon as the subscription is enqueued. * * should_forward_message will be called once per new message, and will * not be called again until the deferred it returns is resolved. The helper * process waits 5 seconds for the result of should_forward_message to be * reported, otherwise it will not forward it.
val subscribe_encode :
t ->
string ->
handle_and_validate_incoming_message:
( 'a Network_peer.Envelope.Incoming.t ->
Validation_callback.t ->
unit Async.Deferred.t ) ->
bin_prot:'a Core.Bin_prot.Type_class.t ->
on_decode_failure:
[ `Ignore
| `Call of string Network_peer.Envelope.Incoming.t -> Core.Error.t -> unit ] ->
'a subscription Async.Deferred.Or_error.tLike subscribe, but knows how to stringify/destringify * * Fails if already subscribed. If it succeeds, incoming messages for that * topic will be written to the Subscription.message_pipe t. Returned deferred * is resolved with Ok sub as soon as the subscription is enqueued. * * should_forward_message will be called once per new message, and will * not be called again until the deferred it returns is resolved. The helper * process waits 5 seconds for the result of should_forward_message to be * reported, otherwise it will not forward it.
val unsubscribe : t -> _ subscription -> unit Async.Deferred.Or_error.tUnsubscribe from this topic, closing the write pipe. * * Returned deferred is resolved once the unsubscription is complete. * This can fail if already unsubscribed.
val publish : t -> 'a subscription -> 'a -> unit Async.Deferred.tPublish a message to this pubsub topic. * * Returned deferred is resolved once the publish is enqueued locally. * This function continues to work even if unsubscribe t has been called. * It is exactly Pubsub.publish with the topic this subscription was * created for, and fails in the same way.
val publish_raw : t -> topic:string -> string -> unit Async.Deferred.tPublish a message to a topic described buy a string. * * Returned deferred is resolved once the publish is enqueued locally. * This function continues to work even if unsubscribe t has been called. * This function allows to publish to the topic to which we are * not necessarily subscribed.