Method: GraphQL::Schema::Subscription.topic_for
- Defined in:
- lib/graphql/schema/subscription.rb
.topic_for(arguments:, field:, scope:) ⇒ String
This is called during initial subscription to get a "name" for this subscription.
Later, when .trigger is called, this will be called again to build another "name".
Any subscribers with matching topic will begin the update flow.
The default implementation creates a string using the field name, subscription scope, and argument keys and values.
In that implementation, only .trigger calls with exact matches result in updates to subscribers.
To implement a filtered stream-type subscription flow, override this method to return a string with field name and subscription scope.
Then, implement #update to compare its arguments to the current object and return NO_UPDATE when an
update should be filtered out.
160 161 162 |
# File 'lib/graphql/schema/subscription.rb', line 160 def self.topic_for(arguments:, field:, scope:) Subscriptions::Serialize.dump_recursive([scope, field.graphql_name, arguments]) end |