connect

Function connect 

Source
pub async fn connect<S: AsRef<str>>(
    uri: S,
) -> Result<(Client, impl Stream<Item = Result<Event, CoreError>> + Unpin), WsError>
Expand description

A wrapper over simploxide_core::connect that turns simploxide_core::RawClient into Client and the event queue into the event stream with automatic event deserialization.

let (client, mut events) = simploxide_client::connect("ws://127.0.0.1:5225").await?;

let current_user  = client.api_show_active_user().await?;
println!("{current_user:#?}");

while let Some(ev) = events.try_next().await? {
    // Process events...
}