package dune-rpc

  1. Overview
  2. Docs
type 'state t
val to_handler : 'state t -> session_version:('state -> int * int) -> menu:Menu.t -> 'state Handler.t
val create : unit -> 'state t
val registered_procedures : 'a t -> (string * int list) list
val declare_notification : 'state t -> 'payload Decl.notification -> unit

A *declaration* of a procedure is a claim that this side of the session is able to *initiate* that procedure. Correspondingly, *implementing* a procedure enables you to *receive* that procedure (and probably do something in response).

Currently, attempting to both implement and declare the same procedure in the same builder will raise. While there is nothing fundamentally wrong with allowing this, it is simpler for the initial version negotiation to treat all method names uniformly, rather than specifying whether a given (set of) generation(s) is implemented or declared.

Finally, attempting to declare or implement the same generation twice will also raise.

val declare_request : 'state t -> ('req, 'resp) Decl.request -> unit
val implement_notification : 'state t -> 'payload Decl.notification -> ('state -> 'payload -> unit Fiber.t) -> unit
val implement_request : 'state t -> ('req, 'resp) Decl.request -> ('state -> 'req -> 'resp Fiber.t) -> unit