Skip to main content

Module ws_client

Module ws_client 

Source
Available on crate feature websocket only.
Expand description

Transport-independent websocket handshakes, connections, and frames. Backends preserve rejected upgrades as HTTP errors with status, headers, and body.

use rig_http::ws_client::websocket_url;

assert_eq!(websocket_url("https://example.com/v1", "responses")?,
           "wss://example.com/v1/responses");

Structs§

CloseFrame
The status code and reason carried by a websocket close frame.
ConnectOptions
Options enforced by the backend during the handshake.
InvalidWebSocketUrl
A base URL that cannot be turned into a websocket URL.

Enums§

Frame
One websocket data or control frame, in either direction.

Traits§

WebSocketClientExt
Opens websocket connections from requests with WS(S) URIs and authentication headers. Backends supply websocket handshake headers such as Sec-WebSocket-Key; callers must not supply those headers.
WebSocketConnection
One open websocket connection, usable as a trait object. Calls are sequential: sessions must not poll send and receive concurrently. WASM-compatible bounds preserve the containing session’s thread-safety contract.

Functions§

websocket_url
Appends path to a base URL, converting HTTP(S) to WS(S) and retaining existing WS(S) schemes, query, and fragment. Trims boundary slashes from the appended path. Returns an error for invalid URLs or unsupported schemes.

Type Aliases§

BoxedWebSocketConnection
A type-erased WebSocketConnection.