Struct async_graphql_axum::GraphQLWebSocket
source · [−]pub struct GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, OnConnInit> { /* private fields */ }
Expand description
A Websocket connection for GraphQL subscription.
Implementations
sourceimpl<S, Query, Mutation, Subscription> GraphQLWebSocket<SplitSink<S, Message>, SplitStream<S>, Query, Mutation, Subscription, fn(_: Value) -> Ready<Result<Data>>>where
S: Stream<Item = Result<Message, Error>> + Sink<Message>,
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
impl<S, Query, Mutation, Subscription> GraphQLWebSocket<SplitSink<S, Message>, SplitStream<S>, Query, Mutation, Subscription, fn(_: Value) -> Ready<Result<Data>>>where
S: Stream<Item = Result<Message, Error>> + Sink<Message>,
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
sourcepub fn new(
stream: S,
schema: Schema<Query, Mutation, Subscription>,
protocol: GraphQLProtocol
) -> Self
pub fn new(
stream: S,
schema: Schema<Query, Mutation, Subscription>,
protocol: GraphQLProtocol
) -> Self
Create a GraphQLWebSocket
object.
sourceimpl<Sink, Stream, Query, Mutation, Subscription> GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, fn(_: Value) -> Ready<Result<Data>>>where
Sink: Sink<Message>,
Stream: Stream<Item = Result<Message, Error>>,
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
impl<Sink, Stream, Query, Mutation, Subscription> GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, fn(_: Value) -> Ready<Result<Data>>>where
Sink: Sink<Message>,
Stream: Stream<Item = Result<Message, Error>>,
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
sourcepub fn new_with_pair(
sink: Sink,
stream: Stream,
schema: Schema<Query, Mutation, Subscription>,
protocol: GraphQLProtocol
) -> Self
pub fn new_with_pair(
sink: Sink,
stream: Stream,
schema: Schema<Query, Mutation, Subscription>,
protocol: GraphQLProtocol
) -> Self
Create a GraphQLWebSocket
object with sink and stream objects.
sourceimpl<Sink, Stream, Query, Mutation, Subscription, OnConnInit, OnConnInitFut> GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, OnConnInit>where
Sink: Sink<Message>,
Stream: Stream<Item = Result<Message, Error>>,
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
OnConnInit: FnOnce(Value) -> OnConnInitFut + Send + 'static,
OnConnInitFut: Future<Output = Result<Data>> + Send + 'static,
impl<Sink, Stream, Query, Mutation, Subscription, OnConnInit, OnConnInitFut> GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, OnConnInit>where
Sink: Sink<Message>,
Stream: Stream<Item = Result<Message, Error>>,
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
OnConnInit: FnOnce(Value) -> OnConnInitFut + Send + 'static,
OnConnInitFut: Future<Output = Result<Data>> + Send + 'static,
sourcepub fn with_data(self, data: Data) -> Self
pub fn with_data(self, data: Data) -> Self
Specify the initial subscription context data, usually you can get something from the incoming request to create it.
sourcepub fn on_connection_init<OnConnInit2, Fut>(
self,
callback: OnConnInit2
) -> GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, OnConnInit2>where
OnConnInit2: FnOnce(Value) -> Fut + Send + 'static,
Fut: Future<Output = Result<Data>> + Send + 'static,
pub fn on_connection_init<OnConnInit2, Fut>(
self,
callback: OnConnInit2
) -> GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, OnConnInit2>where
OnConnInit2: FnOnce(Value) -> Fut + Send + 'static,
Fut: Future<Output = Result<Data>> + Send + 'static,
Specify a callback function to be called when the connection is initialized.
You can get something from the payload of GQL_CONNECTION_INIT
message to create Data
.
The data returned by this callback function will be merged with the data
specified by [with_data
].
Auto Trait Implementations
impl<Sink, Stream, Query, Mutation, Subscription, OnConnInit> !RefUnwindSafe for GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, OnConnInit>
impl<Sink, Stream, Query, Mutation, Subscription, OnConnInit> Send for GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, OnConnInit>where
Mutation: Send + Sync,
OnConnInit: Send,
Query: Send + Sync,
Sink: Send,
Stream: Send,
Subscription: Send + Sync,
impl<Sink, Stream, Query, Mutation, Subscription, OnConnInit> Sync for GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, OnConnInit>where
Mutation: Send + Sync,
OnConnInit: Sync,
Query: Send + Sync,
Sink: Sync,
Stream: Sync,
Subscription: Send + Sync,
impl<Sink, Stream, Query, Mutation, Subscription, OnConnInit> Unpin for GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, OnConnInit>where
OnConnInit: Unpin,
Sink: Unpin,
Stream: Unpin,
impl<Sink, Stream, Query, Mutation, Subscription, OnConnInit> !UnwindSafe for GraphQLWebSocket<Sink, Stream, Query, Mutation, Subscription, OnConnInit>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more