Websocket library for use with cohttp and async
Module type
Class type
Library cohttp_async_websocket
type t

Represents the policy a server should use to when establishing a websocket connection response. On_connection is used to determine what headers to respond with, and how to handle the websocket bytes.

val create : ?set_response_headers:Header.t -> ?should_overwrite_sec_accept_header:bool -> ( string Async.Pipe.Reader.t -> string Async.Pipe.Writer.t -> unit Async.Deferred.t ) -> t

create ?set_response_headers ?should_overwrite_sec_accept_header f allows one to choose response headers and byte processing for the connection.

set_response_headers will seed the default header values for the http response.

should_overwrite_sec_accept_header is used to determine if cohttp should be allowed to overwrite the sec-accept header value, even if that value was present in set_response_headers.

f is given a pipe version of the reader and writer to the websocket client; no websocket framing is expected of f.