Webs_websocketWebsockets upgrade support.
References.
The type for websocket keys. These are random 16 bytes encoded in base64 with padding.
val random_key : ?crypto_random:Webs_crypto_random.t -> unit -> keyrandom_key () is a random websocket key sourced from the generator crypto_random (default to Webs_crypto_random.get).
val accept_header_value_of_key : key -> stringaccept_header_value_of_key k is a value for the sec_websocket_accept header for a key k value of a sec_websocket_key header.
val add_request_upgrade_headers :
?key:key ->
Webs.Http.Headers.t ->
key * Webs.Http.Headers.tupgrade_headers ~key headers adds headers for a Webosocket upgrade using key (defaults to random_key) to headers and returns key.
val request_upgrade_of_url :
?key:key ->
?headers:Webs.Http.Headers.t ->
?log:string ->
?version:Webs.Http.Version.t ->
Webs.Url.t ->
(key * Webs.Http.Request.t, string) Stdlib.resultrequest_upgrade_of_url ~url is a `GET request constructed like Webs.Http.Request.of_url and with headers add_request_upgrade_headers ?key headers added.
val headers_upgradable : Webs.Http.Headers.t -> boolupgradable hs is true iff hs has a header Webs.Http.Headers.connection with an "upgrade" value and a header Webs.Http.Headers.upgrade with a "websocket" value.
val request_upgradable : Webs.Http.Request.t -> boolrequest_upgradable r is true iff Http.Request.headers r satisfies headers_upgradable.
val upgrade_response :
Webs.Http.Request.t ->
(Webs.Http.Response.t, Webs.Http.Response.t) Stdlib.resultupgrade_response responds to upgrade the request to a websocket
val sec_websocket_accept : Webs.Http.Headers.Name.tval sec_websocket_extensions : Webs.Http.Headers.Name.tval sec_websocket_key : Webs.Http.Headers.Name.tval sec_websocket_protocol : Webs.Http.Headers.Name.tval sec_websocket_version : Webs.Http.Headers.Name.t