Module Command.Expert
val param : ?heartbeat_config:Async.Rpc.Connection.Heartbeat_config.t -> ?max_message_size:int -> ?log_not_previously_seen_version:(name:string -> int -> unit) -> unit -> (t list -> unit Async.Deferred.t) Async.Command.Param.t
param ?heartbeat_config ?log_not_previously_seen_version ()
returns a command line parameter which produces a function. You can do any initialization (e.g. of mutable state) and then call the function with your RPC implementations to start the RPC server. The deferred it returns will become determined when the client closes their connection, after which you may do any cleanup you need and then exit (possibly with an appropriate exit status).This interface is marked
Expert
because consuming from stdin or writing to stdout during your initialization may prevent you from receiving RPCs or responding to them properly, but we cannot check that you don't do this or prevent you from doing it, so you just have to be careful.You are responsible for ensuring that the async scheduler is started, e.g., by calling
Command.async_or_error'
.