pub struct WsClient { /* private fields */ }Expand description
WebSocket client for consuming AG-UI event streams.
The client connects to a WebSocket endpoint and provides a stream of parsed AG-UI events.
Implementations§
Source§impl WsClient
impl WsClient
Sourcepub async fn connect_with_config(url: &str, config: WsConfig) -> Result<Self>
pub async fn connect_with_config(url: &str, config: WsConfig) -> Result<Self>
Connects to a WebSocket endpoint with custom configuration.
§Arguments
url- The WebSocket endpoint URL (ws:// or wss://)config- Connection configuration
§Example
ⓘ
let config = WsConfig::new()
.bearer_token("my-token");
let client = WsClient::connect_with_config("ws://localhost:3000/ws", config).await?;Sourcepub fn into_stream(self) -> WsEventStream
pub fn into_stream(self) -> WsEventStream
Converts this client into an event stream.
The stream yields parsed AG-UI events as they arrive.
Auto Trait Implementations§
impl !Freeze for WsClient
impl !RefUnwindSafe for WsClient
impl Send for WsClient
impl Sync for WsClient
impl Unpin for WsClient
impl UnsafeUnpin for WsClient
impl !UnwindSafe for WsClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more