Hive.Pubsub.Local

hive · API reference

In-process transport used by local.

This module is public mostly for tests and examples that want to exercise the functor explicitly. Most applications can call local directly.

type t

Local callback table.

val create : unit -> t

Create an empty local transport.

val publish : t -> topic:string -> payload:string -> unit

Publish an opaque payload to topic.

val subscribe : t -> topic:string -> (payload:string -> unit) -> unsubscribe

Subscribe a callback to topic.

The returned function releases just this subscription. It should be safe to call more than once.