connect

Function connect 

Source
pub async fn connect(
    simplex_daemon_url: &str,
) -> Result<(RawClient, RawEventQueue)>
Expand description

Connect to the running SimpleX daemon by websocket URI str. Note that SimpleX doesn’t support TLS so using “wss://” will produce an error.

Returns a client that should be used to send requests and receive responses and the event queue that buffers SimpleX chat events.

If you’re writing a script-like app that doesn’t need to process events drop the returned event queue immediately to prevent the events being buffered effectively causing a memory leak.

Example:

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

// (Optional) Drop the event queue if you're not planning to handle events
drop(events)

let current_user  = client.send("/user".to_owned()).await?;
println!("{}", serde_json::to_string_pretty(&current_user).unwrap());