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§
- Close
Frame - The status code and reason carried by a websocket close frame.
- Connect
Options - Options enforced by the backend during the handshake.
- Invalid
WebSocket Url - A base URL that cannot be turned into a websocket URL.
Enums§
- Frame
- One websocket data or control frame, in either direction.
Traits§
- WebSocket
Client Ext - 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. - WebSocket
Connection - 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
pathto 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§
- Boxed
WebSocket Connection - A type-erased
WebSocketConnection.