package resp-server

  1. Overview
  2. Docs

Construct a new SERVER with given authentication mode and backend

Parameters

module A : AUTH
module D : BACKEND

Signature

module Auth = A

Authentication mode

module Backend = D

Backend mode

val ok : Value.t option Lwt.t

Respond with OK simple string

val error : string -> Value.t option Lwt.t

Respond with an error

val invalid_arguments : unit -> Value.t option Lwt.t

Response with an invalid arguments error

type t

Underlying server type, this is typically not available to consumers of the API

type command = Backend.t -> Backend.client -> string -> Value.t array -> Value.t option Lwt.t

The signature of a command function

val create : ?auth:Auth.t -> ?default:command -> ?commands:(string * command) list -> ?host:string -> ?tls_config:Conduit_lwt_unix.tls_server_key -> Conduit_lwt_unix.server -> Backend.t -> t Lwt.t

Create a new server instance.

  • auth sets the authentication
  • default sets the default command handler
  • commands sets the commands for the server
  • host is the hostname of the server (ex 127.0.0.1)
  • tls_config configures ssl for the server - see conduit-lwt-unix for more inforation
  • The server type is also inherited from Conduit, but typically you will use either `TCP (`PORT $PORTNUMBER) or `Unix_domain_socket (`File $FILENAME)
val start : ?backlog:int -> ?timeout:int -> ?stop:unit Lwt.t -> ?on_exn:(exn -> unit) -> t -> unit Lwt.t

Run the server

OCaml

Innovation. Community. Security.