Crate graphql_ws_client
source ·Expand description
§graphql-ws-client
graphql-ws-client implements asynchronous GraphQL-over-Websocket using the graphql-transport-ws protocol. It is websocket client, graphql client and async runtime agnostic. Built in support is provided for:
- Cynic & Graphql-Client GraphQL clients.
- async-tungstenite & ws-stream-wasm Websocket Clients .
- Any async runtime.
If you’d like to use another client or adding support should be trivial.
use graphql_ws_client::Client;
use std::future::IntoFuture;
use futures::StreamExt;
let mut stream = Client::build(connection).subscribe(subscription).await?;
while let Some(response) = stream.next().await {
// Do something with response
}
See the examples for more thorough usage details.
Modules§
- This module contains traits that abstract over GraphQL implementations, allowing this library to be used with different GraphQL client libraries.
- Contains traits to provide support for various underlying websocket clients.
- ws_stream_wasm
ws_stream_wasm
Integration with the ws_stream_wasm library
Structs§
- AsyncWebsocketClientDeprecatedA websocket client
- AsyncWebsocketClientBuilderDeprecatedA websocket client builder
- A GraphQL over Websocket client
- Builder for Graphql over Websocket clients
- The
ConnectionActor
contains the main loop for handling incoming & outgoing messages for a Client. - Sink for the
with
method. - A
futures::Stream
for a subscription. - A
futures::Stream
for a subscription.
Enums§
- Error type
- A websocket message
- WasmWebsocketMessage
ws_stream_wasm
A WebSocket event abstraction to combine the differentiated WebSocket events and messages ofws_stream_wasm
.
Traits§
- Abstrction around a websocket connection.
Functions§
- Creates a new pair of sink and stream which operate on
WasmWebsocketMessage
instead ofWsMessage
andWsEvent
separately.
Type Aliases§
- A websocket client for the cynic graphql crate
- A websocket client builder for the cynic graphql crate
- A websocket client for the graphql_client graphql crate
- A websocket client builder for the graphql_client graphql crate