pub struct Client { /* private fields */ }
Expand description
A GraphQL over Websocket client
use graphql_ws_client::Client;
use std::future::IntoFuture;
use futures_lite::StreamExt;
let (mut client, actor) = Client::build(connection).await?;
// Spawn the actor onto an async runtime
spawn(actor.into_future());
let mut subscription = client.subscribe(subscription).await?;
while let Some(response) = subscription.next().await {
// Do something with response
}
Implementations§
Source§impl Client
impl Client
Sourcepub fn build<Conn>(connection: Conn) -> ClientBuilderwhere
Conn: Connection + Send + 'static,
pub fn build<Conn>(connection: Conn) -> ClientBuilderwhere
Conn: Connection + Send + 'static,
Creates a ClientBuilder
with the given connection.
use graphql_ws_client::Client;
use std::future::IntoFuture;
let (client, actor) = Client::build(connection).await?;
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
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