package vcaml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Implements the Msgpack RPC protocol. See https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md

module Event : sig ... end
module Error : sig ... end
type 'state t
val create : on_error:(Error.t -> Base.unit) -> [ `not_connected ] t
val notifications : _ t -> (Event.t -> Base.unit) Bus.Read_only.t

Although you can still subscribe after the RPC is connected, note that if you do you may miss events sent before the subscription.

val register_method : _ t -> name:Base.string -> f:(Msgpack.t Base.list -> Msgpack.t Async_kernel.Deferred.Or_error.t) -> [ `Ok | `Duplicate ]

Although you can still register methods after the RPC is connected, note that if clients call the method before registration they will see an error for an undefined method.

val connect : [ `not_connected ] t -> Async.Reader.t -> Async.Writer.t -> close_reader_and_writer_on_disconnect:Base.bool -> [ `connected ] t

Once connect is called the counterparty can start calling methods and sending notifications. Any methods that should be callable at that time should be registered beforehand, as should any subscriptions to the event bus. Calling connect twice will raise.

val reader : [ `connected ] t -> Async.Reader.t
val writer : [ `connected ] t -> Async.Writer.t
val call : [ `connected ] t -> method_name:Base.string -> parameters:Msgpack.t Base.list -> (Msgpack.t, Msgpack.t) Async_kernel.Deferred.Result.t
val notify : [ `connected ] t -> method_name:Base.string -> parameters:Msgpack.t Base.list -> Base.unit
OCaml

Innovation. Community. Security.