Module Evm_node_lib_dev.Evm_websocket

val cohttp_callback : ?monitor:Evm_node_config.Configuration.monitor_websocket_heartbeat -> max_message_length:int -> Rpc_encodings.websocket_handler -> Cohttp_lwt_unix.Server.conn -> Cohttp.Request.t -> 'body -> Cohttp_lwt_unix.Server.response_action Lwt.t

Callback to use for a websocket endpoint in a Cohttp server. cohttp_callback ?monitor ~max_message_length handler conn req body upgrades the connection for request req to the websocket protocol and starts worker that processes incoming frames and writes in return in the websocket. max_message_length specifies the maximum size of message accepted by the server, over which the connection will be closed. If monitor is provided, the websocket connection is monitored with the given parameters and the connection closed if the client fails to answer.

val on_conn_closed : Cohttp_lwt_unix.Server.conn -> unit

Callback to be called by Cohttp when it detects a closed connection before any read/write happens. on_conn_closed conn stops the websocket worker and cleans resources associated to connection conn, if it exists.

type 'strategy rate_limit = {
  1. max : int;
    (*

    Max allowed websocket frames or messages in the below interval.

    *)
  2. interval : Tezos_base.TzPervasives.Time.System.Span.t;
    (*

    Interval for the rate limit.

    *)
  3. strategy : 'strategy;
    (*

    Strategy to adopt when a client sends messages which exceed the defined rate limit.

    *)
} constraint 'strategy = [< `Wait | `Error | `Close ]
val setup_rate_limiters : ?messages_limit:[ `Wait | `Close | `Error ] rate_limit -> ?frames_limit:[ `Close ] rate_limit -> unit -> unit Tezos_base.TzPervasives.tzresult

Setup the rate limiters parameters for the websocket server (for all connections).