Struct async_graphql_poem::GraphQLWebSocket
source · pub struct GraphQLWebSocket<Sink, Stream, E, OnConnInit> { /* private fields */ }
Expand description
A Websocket connection for GraphQL subscription.
Implementations§
source§impl<S, E> GraphQLWebSocket<SplitSink<S, Message>, SplitStream<S>, E, fn(_: Value) -> Ready<Result<Data>>>
impl<S, E> GraphQLWebSocket<SplitSink<S, Message>, SplitStream<S>, E, fn(_: Value) -> Ready<Result<Data>>>
sourcepub fn new(stream: S, executor: E, protocol: GraphQLProtocol) -> Self
pub fn new(stream: S, executor: E, protocol: GraphQLProtocol) -> Self
Create a GraphQLWebSocket
object.
source§impl<Sink, Stream, E> GraphQLWebSocket<Sink, Stream, E, fn(_: Value) -> Ready<Result<Data>>>
impl<Sink, Stream, E> GraphQLWebSocket<Sink, Stream, E, fn(_: Value) -> Ready<Result<Data>>>
sourcepub fn new_with_pair(
sink: Sink,
stream: Stream,
executor: E,
protocol: GraphQLProtocol,
) -> Self
pub fn new_with_pair( sink: Sink, stream: Stream, executor: E, protocol: GraphQLProtocol, ) -> Self
Create a GraphQLWebSocket
object with sink and stream objects.
source§impl<Sink, Stream, E, OnConnInit, OnConnInitFut> GraphQLWebSocket<Sink, Stream, E, OnConnInit>
impl<Sink, Stream, E, OnConnInit, OnConnInitFut> GraphQLWebSocket<Sink, Stream, E, OnConnInit>
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, E, OnConnInit2>
pub fn on_connection_init<OnConnInit2, Fut>( self, callback: OnConnInit2, ) -> GraphQLWebSocket<Sink, Stream, E, OnConnInit2>
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, E, OnConnInit> Freeze for GraphQLWebSocket<Sink, Stream, E, OnConnInit>
impl<Sink, Stream, E, OnConnInit> !RefUnwindSafe for GraphQLWebSocket<Sink, Stream, E, OnConnInit>
impl<Sink, Stream, E, OnConnInit> Send for GraphQLWebSocket<Sink, Stream, E, OnConnInit>
impl<Sink, Stream, E, OnConnInit> Sync for GraphQLWebSocket<Sink, Stream, E, OnConnInit>
impl<Sink, Stream, E, OnConnInit> Unpin for GraphQLWebSocket<Sink, Stream, E, OnConnInit>
impl<Sink, Stream, E, OnConnInit> !UnwindSafe for GraphQLWebSocket<Sink, Stream, E, OnConnInit>
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