Struct hrana_client::Client
source · pub struct Client { /* private fields */ }
Implementations§
source§impl Client
impl Client
sourcepub async fn connect(url: &str, jwt: Option<String>) -> Result<(Self, ConnFut)>
pub async fn connect(url: &str, jwt: Option<String>) -> Result<(Self, ConnFut)>
Connects to the remote hrana server.
Returns a Client
handle, along with a HranaConnFut
that drives the socket connection,
and needs to be awaited
Example:
ⓘ
let (client, fut) = Client::connect("ws://localhost:8080", None).await?;
let handle = tokio::task::spawn(fut);
let stream = client.open_stream().await?;
// do things with stream...
// collect errors
handle.await??
sourcepub async fn open_stream(&self) -> Result<Stream>
pub async fn open_stream(&self) -> Result<Stream>
Open a new stream on this client
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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