Skip to main content

Module transport

Module transport 

Source
Expand description

Connected WebSocket transport and the registry kind for ws / wss.

WsTransport wraps a [tungstenite::WebSocket] and implements confium_net::Transport. Each send is written as one WebSocket binary frame; each recv reads one binary frame. The WebSocket protocol itself preserves message boundaries, so โ€” unlike [confium_net_tcp] โ€” no length-prefix layer is needed.

The transport is generic over the underlying stream so the same type serves both dial-out clients (whose stream is MaybeTlsStream<TcpStream> โ€” plain for ws://, TLS for wss://) and accepted servers (whose stream is bare TcpStream). A sealed [WsInner] trait abstracts the two behind a single Box<dyn WsInner> so callers see one concrete WsTransport type regardless of how the connection was established.

Structsยง

WsTransport
Connected WebSocket transport. Owns the underlying [tungstenite::WebSocket]; close sends a WebSocket Close frame so the peer observes a clean end-of-stream.
WsTransportKind
Registry kind for ws, wss.