Skip to main content

Module websocket

Module websocket 

Source
Expand description

Host-side WebSocket connections for Oxide guest modules.

Guests call the api_ws_* imports to open connections, send messages, poll for incoming messages, query connection state, and close connections. All I/O is non-blocking from the guest’s perspective: the host spins up a tokio task per connection that drives the underlying tokio-tungstenite stream, pushes received frames into a VecDeque, and forwards outgoing frames from an mpsc channel.

Structs§

WsState
All WebSocket state for a tab. Lazily initialised on the first api_ws_* call.

Constants§

WS_CLOSED
Connection is closed or could not be opened.
WS_CLOSING
Connection is in the process of closing.
WS_CONNECTING
Connection is being established.
WS_OPEN
Connection is open and ready to communicate.

Functions§

register_ws_functions
Register all api_ws_* host functions on the given linker.