Skip to main content

Module ws

Module ws 

Source
Expand description

WebSocket transport support.

This module provides WebSocket upgrade handling for the server. The WsIo adapter is provided by trojan-core::transport.

Structs§

WsIo
WebSocket stream adapter that exposes AsyncRead/AsyncWrite using binary frames.

Enums§

WsInspect
Result of inspecting buffered bytes for WebSocket upgrade.

Constants§

INITIAL_BUFFER_SIZE
Initial buffer size for reading HTTP headers during WebSocket upgrade.

Functions§

accept_ws
Accept a WebSocket upgrade on the given stream.
inspect_mixed
Inspect buffered bytes for WebSocket upgrade in mixed mode.
send_reject
Send an HTTP 400 Bad Request response to reject the connection.