class GraphQL::Subscriptions::Instrumentation
-
Evaluating the triggered portion(s) of the subscription during later execution
- Registering the subscription during the first execution
Wrap the root fields of the subscription type with special logic for:
def after_query(query)
def after_query(query) events = query.context.namespace(:subscriptions)[:events] if events && events.any? @schema.subscriptions.write_subscription(query, events) end end
def before_query(query)
def before_query(query) if query.subscription? && !query.subscription_update? query.context.namespace(:subscriptions)[:events] = [] end end
def initialize(schema:)
def initialize(schema:) @schema = schema end