Skip to main content

Module websocket

Module websocket 

Source
Expand description

WebSocket client with auto-reconnect, message queueing, and channel mux.

Driven by tick(dt) each frame. Messages arrive as WsEvent values polled from drain_events(). Send messages with send().

Needs the websocket cargo feature for a real connection (tungstenite, rustls for wss://).

Auto-reconnect: exponential backoff on disconnect. Message queue: outgoing messages buffered during disconnection. Channels: local labels on outgoing messages (not sent on the wire).

Structs§

ChannelConfig
A logical channel registered with WsClient::subscribe.
WsClient
WebSocket client driven by tick().

Enums§

WsEvent
Something that happened on the connection, from WsClient::drain_events.
WsMessage
A WebSocket message.
WsState
Connection state of a WsClient.