package dune-rpc

  1. Overview
  2. Docs

Functor to create a client implementation

Rpc client

Parameters

module Fiber : sig ... end
module Chan : sig ... end

Signature

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:Id.t -> t -> ('a, 'b) Versioned.request -> 'a -> ('b, Response.Error.t) result Fiber.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 Fiber.t
val disconnected : t -> unit Fiber.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:Id.t -> t -> 'a Sub.t -> ('a Stream.t, Version_error.t) result Fiber.t

poll client sub Initialize a polling loop for sub

module Batch : sig ... end
val connect : ?handler:Handler.t -> Chan.t -> Initialize.t -> f:(t -> 'a Fiber.t) -> 'a Fiber.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.