Up

Module Channel

A Channel.t is a bi-directional communication channel for communicating to a Hub.t. Channels are portable across processes. A channel can be sent to another process, either explicitly or by being in a closure and it will continue to work.

Signature

type ('to_hub, 'from_hub) t
val create : ?buffer_age_limit:[
| `At_most of Core.Std.Time.Span.t
| `Unlimited
] -> addr:Async.Std.Unix.Inet_addr.t * int -> unit -> (_, _) t Async.Std.Deferred.t

create is type-unsafe, and should not be used by user code.

val close : (_, _) t -> unit Async.Std.Deferred.t
val read : (_, 'b) t -> 'b Async.Std.Deferred.t
val write : ('a, _) t -> 'a -> unit
type 'a pre_packed
val pre_pack : 'a -> 'a pre_packed
val write_pre_packed : ('a, _) t -> 'a pre_packed -> unit
val flushed : (_, _) t -> unit Async.Std.Deferred.t
val socket : (_, _) t -> Async.Std.Unix.Inet_addr.t * int
val errors : (_, _) t -> exn Async.Std.Stream.t

Similar to Monitor.detach_and_get_error_stream, collects all writer errors. If this function has never been called, then exceptions will be raised directly