package dune-rpc

  1. Overview
  2. Docs

Module Client.MakeSource

Functor to create a client implementation

Rpc client

Parameters

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

Signature

Sourcetype t
Sourcemodule Handler : sig ... end
Sourcemodule 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".

Sourceval 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.

Sourceval notification : t -> 'a Versioned.notification -> 'a -> unit Fiber.t
Sourceval 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).

Sourcemodule Stream : sig ... end

Control for a polling loop

Sourceval 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

Sourcemodule Batch : sig ... end
Sourceval 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.