ws_h1_upgrade (ws v0.1.1)
View SourceRFC 6455 handshake helpers for WebSocket over HTTP/1.1.
Embedders provide a parsed HTTP request or response (method, target, headers) and this module validates the WebSocket-specific pieces and builds the peer-side headers. The embedder is responsible for actually driving the socket: writing the request line / status line, serialising the response headers, handing the byte stream over to ws_session once the handshake is done.
Headers are accepted in either list({binary(), binary()}) or map() shape; names are compared case-insensitively.
Summary
Types
Functions
-spec client_key() -> binary().
-spec response_headers(request_info()) -> [header()].
-spec response_headers(request_info(), map()) -> [header()].
-spec validate_request(headers()) -> {ok, request_info()} | {error, term()}.
-spec validate_request(headers(), request_opts()) -> {ok, request_info()} | {error, term()}.