package json-rpc
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=f881e0d1cdf277ee6bde864c0a7939a4fcb880c0707540ad53c17f9b845baaa3
md5=f5f683fa4a5d025c530eee501347e7c7
doc/jsonrpc/Jsonrpc/Server/index.html
Module Jsonrpc.Server
type reply = (json, int * string) Result.resultthe return value of an JSON-RPC function
module Error : sig ... endval create : unit -> tcreate a JSON-RPC server; the default function will be set to (fun _ -> Error.method_not_found), returning this error message as reply to all requests.
add_cb srv ~name cb add the callback function cb to the server src. The function will be called in a JSON-RPC request matches the given function name name.
set_default src cb sets the default callback function to cb in the server srv. This function is called if no callback function matches the function name in the RPC reuqest.
val remove_cb : name:string -> t -> unitremove_cb ~name srv removes the callback function for name name from the server srv.
evalj srv json_in generates a return value for the given JSON-RPC request json_in for the server srv. If no answer is to be sent back to the caller, this function will return None.
val eval : t -> string -> string optioneval srv s works just like evalj srv json but will parse the value s to JSON; it also converts the reply to a string value to be sent back to the caller.