package dune-rpc-lwt

  1. Overview
  2. Docs

Rpc client

type t
module Handler : sig ... end
module Versioned : sig ... end

Individual RPC procedures are versioned beyond the larger API version. At session startup, the server and client exchange version information for each method ("negotiation"), setting on a common version for each (if possible) to produce a "version menu".

val request : ?id:Dune_rpc.V1.Id.t -> t -> ('a, 'b) Versioned.request -> 'a -> ('b, Dune_rpc.V1.Response.Error.t) Stdlib.result Lwt.t

request ?id client decl req send a request req specified by decl to client. If id is None, it will be automatically generated.

val notification : t -> 'a Versioned.notification -> 'a -> unit Lwt.t
val disconnected : t -> unit Lwt.t

disconnected client produces a fiber that only becomes determined when the session is ended from the server side (such as if the build server is killed entirely).

module Stream : sig ... end

Control for a polling loop

val poll : ?id:Dune_rpc.V1.Id.t -> t -> 'a Dune_rpc.V1.Sub.t -> ('a Stream.t, Dune_rpc.V1.Version_error.t) Stdlib.result Lwt.t

poll client sub Initialize a polling loop for sub

module Batch : sig ... end
val connect : ?handler:Handler.t -> (Lwt_io.input_channel * Lwt_io.output_channel) -> Dune_rpc.V1.Initialize.t -> f:(t -> 'a Lwt.t) -> 'a Lwt.t

connect ?on_handler session init ~f connect to session, initialize with init and call f once the client is initialized. handler is called for some notifications sent to session

OCaml

Innovation. Community. Security.