Library
Module
Module type
Parameter
Class
Class type
type json = Yojson.Basic.json
request ~id ~params name
generates a request message with method name name
, identifier id
and parameters params
directly as JSON value. request ~id ~params name = to_json (Request { name; params; id })
notification ~params name
generate a notification message with method name name
and parameters params
directly as JSON value. notification ~params name = to_json (Notification { name; params }
response ~id data
generates a response message with identifier id
and payload data
directly as JSON value. response ~id result = to_json (Response { result; id })
error ~id ~data code message
generates an error message with identifier id
and error-triplet code
, message
and optionally data
. error ~id ~data code message = to_json (Error { code; message; data; id })
val to_string : t -> string
convert a message type t
to string
val of_json : json -> (t, string) Result.result
parse a JSON value to a JSON-RPC message value; in case of an error, Result.Error
is returned.
parse a JSON value to a JSON-RPC message value; in case of an error, Invalid_argument
is raised.
val of_string : string -> (t, string) Result.result
parse a JSON value to a JSON-RPC message value from a string; in case of an error, Result.Error
is returned.
val of_string_exn : string -> t
parse a JSON value to a JSON-RPC message value from a string; in case of an error either Invalid_argument
or Yojson.Json_error
are raised.
module Server : sig ... end