package async_rpc_websocket

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Connection_source : sig ... end
module Connection_initiated_from : sig ... end
type should_process_request = Async.Socket.Address.Inet.t -> (Cohttp.Header.t * [ `is_websocket_request of bool ]) Connection_source.t -> unit Core.Or_error.t
type ('s, 'c, 'r) common_args = implementations:'s Async.Rpc.Implementations.t -> initial_connection_state: ('c -> Connection_initiated_from.t -> Async.Socket.Address.Inet.t -> Async.Rpc.Connection.t -> 's) -> ?http_handler:('c -> http_handler) -> ?handshake_timeout:Core.Time.Span.t -> ?heartbeat_config:Async.Rpc.Connection.Heartbeat_config.t -> ?should_process_request:should_process_request -> ?on_handshake_error:Async.Rpc.Connection.on_handshake_error -> 'r

The 'c argument allows a wrapper for handler to pass extra information to the initial_connection_state and http_handler handlers. This parameter is fixed to unit in the functions other than handler.

type ('s, 'r, 'l) serve_args = where_to_listen:(Async.Socket.Address.Inet.t, 'l) Async.Tcp.Where_to_listen.t -> ('s, unit, ?on_handler_error: [ `Raise | `Ignore | `Call of Async.Socket.Address.Inet.t -> exn -> unit ] -> ?mode:Conduit_async.server -> ?backlog:int -> ?max_connections:int -> unit -> 'r) common_args
val handler : ?description:Core.Info.t -> ('s, 'c, 'c -> raw_http_handler) common_args

This returns a http handler that can be added into an existing cohttp server

val serve_with_tcp_server : where_to_listen_for_tcp: (Async.Socket.Address.Inet.t, 'l) Async.Tcp.Where_to_listen.t -> ?max_message_size:int -> ?make_transport:Async.Rpc.Connection.transport_maker -> ('s, 'l tcp_server * 'l ws_server, 'l) serve_args

Serves both HTTP/Websockets and regular RPCs via TCP server.

val serve : ('s, 'l ws_server, 'l) serve_args

Serves HTTP/Websockets only

Connect to a Websockets RPC server at the given URI.