pub struct GraphQLSubscription<E, OnConnInit = DefaultOnConnInitType, OnPing = DefaultOnPingType>where
E: Executor,{ /* private fields */ }Available on crate feature
async-graphql only.Expand description
GraphQL WebSocket subscription responder (GraphQL over WebSocket).
Usage in a handler:
ⓘ
let schema = Schema::build(QueryRoot, MutationRoot, SubscriptionRoot).finish();
router.route(Method::GET, "/ws", move |req: Request| {
let schema = schema.clone();
async move { GraphQLSubscription::new(req, schema) }
});Implementations§
Source§impl<E> GraphQLSubscription<E, DefaultOnConnInitType, DefaultOnPingType>where
E: Executor,
impl<E> GraphQLSubscription<E, DefaultOnConnInitType, DefaultOnPingType>where
E: Executor,
Source§impl<E, OnConnInit, OnPing> GraphQLSubscription<E, OnConnInit, OnPing>where
E: Executor,
impl<E, OnConnInit, OnPing> GraphQLSubscription<E, OnConnInit, OnPing>where
E: Executor,
pub fn with_data(self, data: Data) -> Self
pub fn keepalive_timeout(self, timeout: impl Into<Option<Duration>>) -> Self
pub fn on_connection_init<F, Fut>( self, f: F, ) -> GraphQLSubscription<E, F, OnPing>
pub fn on_ping<F, Fut>(self, f: F) -> GraphQLSubscription<E, OnConnInit, F>
Trait Implementations§
Source§impl<E, OnConnInit, OnConnInitFut, OnPing, OnPingFut> Responder for GraphQLSubscription<E, OnConnInit, OnPing>where
E: Executor + Send + Sync + Clone + 'static,
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<E, OnConnInit, OnConnInitFut, OnPing, OnPingFut> Responder for GraphQLSubscription<E, OnConnInit, OnPing>where
E: Executor + Send + Sync + Clone + 'static,
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,
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Converts the implementing type into an HTTP response.
Auto Trait Implementations§
impl<E, OnConnInit = fn(Value) -> Ready<Result<Data, Error>>, OnPing = fn(Option<&Data>, Option<Value>) -> Ready<Result<Option<Value>, Error>>> !Freeze for GraphQLSubscription<E, OnConnInit, OnPing>
impl<E, OnConnInit = fn(Value) -> Ready<Result<Data, Error>>, OnPing = fn(Option<&Data>, Option<Value>) -> Ready<Result<Option<Value>, Error>>> !RefUnwindSafe for GraphQLSubscription<E, OnConnInit, OnPing>
impl<E, OnConnInit, OnPing> Send for GraphQLSubscription<E, OnConnInit, OnPing>
impl<E, OnConnInit = fn(Value) -> Ready<Result<Data, Error>>, OnPing = fn(Option<&Data>, Option<Value>) -> Ready<Result<Option<Value>, Error>>> !Sync for GraphQLSubscription<E, OnConnInit, OnPing>
impl<E, OnConnInit, OnPing> Unpin for GraphQLSubscription<E, OnConnInit, OnPing>
impl<E, OnConnInit = fn(Value) -> Ready<Result<Data, Error>>, OnPing = fn(Option<&Data>, Option<Value>) -> Ready<Result<Option<Value>, Error>>> !UnwindSafe for GraphQLSubscription<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