package dune-rpc

  1. Overview
  2. Docs

Rpc client

type t
type 'a fiber
type chan
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:Id.t -> t -> ('a, 'b) Versioned.request -> 'a -> ('b, Response.Error.t) result fiber

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 fiber
val disconnected : t -> unit fiber

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:Id.t -> t -> 'a Sub.t -> ('a Stream.t, Version_error.t) result fiber

poll client sub Initialize a polling loop for sub

module Batch : sig ... end
val connect : ?handler:Handler.t -> chan -> Initialize.t -> f:(t -> 'a fiber) -> 'a fiber

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.