pub struct GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, OnPing>where
E: Executor,{ /* private fields */ }Available on crate feature
async-graphql only.Expand description
A generic GraphQL WebSocket driver using an arbitrary Sink/Stream of tungstenite Messages.
This is a generic API so you can integrate custom websocket transports while reusing Tako’s mapping to async-graphql’s WebSocket state machine.
Implementations§
Source§impl<S, E> GraphQLWebSocket<SplitSink<S, Message>, SplitStream<S>, E, DefaultOnConnInitType, DefaultOnPingType>
impl<S, E> GraphQLWebSocket<SplitSink<S, Message>, SplitStream<S>, E, DefaultOnConnInitType, DefaultOnPingType>
Sourcepub fn new(stream: S, executor: E, protocol: WebSocketProtocols) -> Self
pub fn new(stream: S, executor: E, protocol: WebSocketProtocols) -> Self
Create a GraphQLWebSocket from a combined websocket stream implementing Sink+Stream.
Source§impl<SinkT, StreamT, E> GraphQLWebSocket<SinkT, StreamT, E, DefaultOnConnInitType, DefaultOnPingType>
impl<SinkT, StreamT, E> GraphQLWebSocket<SinkT, StreamT, E, DefaultOnConnInitType, DefaultOnPingType>
Sourcepub fn new_with_pair(
sink: SinkT,
stream: StreamT,
executor: E,
protocol: WebSocketProtocols,
) -> Self
pub fn new_with_pair( sink: SinkT, stream: StreamT, executor: E, protocol: WebSocketProtocols, ) -> Self
Create a GraphQLWebSocket from separate sink and stream.
Source§impl<SinkT, StreamT, E, OnConnInit, OnPing> GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, OnPing>
impl<SinkT, StreamT, E, OnConnInit, OnPing> GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, OnPing>
Source§impl<SinkT, StreamT, E, OnConnInit, OnConnInitFut, OnPing, OnPingFut> GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, OnPing>where
SinkT: Sink<Message> + Unpin,
StreamT: Stream<Item = Result<Message, Error>> + Unpin,
E: Executor,
OnConnInit: FnOnce(Value) -> OnConnInitFut + Send + 'static,
OnConnInitFut: Future<Output = Result<Data>> + Send + 'static,
OnPing: FnOnce(Option<&Data>, Option<Value>) -> OnPingFut + Clone + Send + 'static,
OnPingFut: Future<Output = Result<Option<Value>>> + Send + 'static,
impl<SinkT, StreamT, E, OnConnInit, OnConnInitFut, OnPing, OnPingFut> GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, OnPing>where
SinkT: Sink<Message> + Unpin,
StreamT: Stream<Item = Result<Message, Error>> + Unpin,
E: Executor,
OnConnInit: FnOnce(Value) -> OnConnInitFut + Send + 'static,
OnConnInitFut: Future<Output = Result<Data>> + Send + 'static,
OnPing: FnOnce(Option<&Data>, Option<Value>) -> OnPingFut + Clone + Send + 'static,
OnPingFut: Future<Output = Result<Option<Value>>> + Send + 'static,
pub fn on_connection_init<F, Fut>( self, callback: F, ) -> GraphQLWebSocket<SinkT, StreamT, E, F, OnPing>
pub fn on_ping<F, Fut>( self, callback: F, ) -> GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, F>
Auto Trait Implementations§
impl<SinkT, StreamT, E, OnConnInit, OnPing> Freeze for GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, OnPing>
impl<SinkT, StreamT, E, OnConnInit, OnPing> !RefUnwindSafe for GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, OnPing>
impl<SinkT, StreamT, E, OnConnInit, OnPing> Send for GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, OnPing>
impl<SinkT, StreamT, E, OnConnInit, OnPing> Sync for GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, OnPing>
impl<SinkT, StreamT, E, OnConnInit, OnPing> Unpin for GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, OnPing>
impl<SinkT, StreamT, E, OnConnInit, OnPing> !UnwindSafe for GraphQLWebSocket<SinkT, StreamT, E, OnConnInit, OnPing>
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