use std::{net::SocketAddr, str::FromStr}; use ezsockets::{Client, ClientConfig, ClientExt}; use url::Url; pub async fn connect( client_fn: impl FnOnce(Client) -> E, address: SocketAddr, ) -> Client { let url = format!("ws://{}/websocket", address); let url = Url::from_str(&url).unwrap(); let (client, _) = ezsockets::connect( client_fn, ClientConfig::new(url).header("Some-Header", "someValue"), ) .await; client }