Function graphql_subscription_handler

Source
pub async fn graphql_subscription_handler<Query, Mutation, Subscription, S: Subject, M: RequestDataMiddleware<S>, St: AuthState<S> + CorsState, B>(
    __arg0: State<St>,
    __arg1: Extension<Schema<Query, Mutation, Subscription>>,
    __arg2: Extension<RequestId>,
    middleware: Option<Extension<M>>,
    accept_language: AcceptLanguage,
    req: Request<B>,
) -> Response
where Query: ObjectType + 'static, Mutation: ObjectType + 'static, Subscription: SubscriptionType + 'static,
Expand description

Handler for GraphQL subscriptions.

Note: For HTTP/1.1 requests, this handler requires the request method to be GET; in later versions, CONNECT is used instead. To support both, it should be used with any.

RequestId, Option<Subject> and AcceptLanguage will be added to the GraphQL context before executing the request on the schema.

This handler expects two extensions:

  • Schema<Query, Mutation, Subscription> with the GraphQL Schema
  • RequestId with the request id (see RequestIdLayer)

And optionally:

Authentication will be performed using the same criteria than Auth extractor, retrieving the Cookie from the GET request and the token from the GQL_CONNECTION_INIT message.