package capnp-rpc-lwt

  1. Overview
  2. Docs

Stretching capability references across a network link. Note: see Capnp_rpc_unix for a higher-level wrapper for this API.

type t

A CapTP connection to a remote peer.

val connect : ?offer:'a Capability.t -> ?tags:Logs.Tag.set -> switch:Lwt_switch.t -> Endpoint.t -> t

connect ?offer ~switch endpoint is fresh CapTP protocol handler that sends and receives messages using endpoint. If offer is given, the peer can use the "Bootstrap" message to get access to it. If the connection fails then switch will be turned off, and turning off the switch will release all resources used by the connection.

val bootstrap : t -> 'a Capability.t

bootstrap t is the peer's public bootstrap object, if any.

val disconnect : t -> Capnp_rpc.Exception.t -> unit Lwt.t

disconnect reason closes the connection, sending reason to the peer to explain why. Capabilities and questions at both ends will break, with reason as the problem.

val dump : t Fmt.t

dump dumps the state of the connection, for debugging.

OCaml

Innovation. Community. Security.