|
NAMEGraphQL::Subscription - Implement GraphQL subscriptionsSYNOPSISuse GraphQL::Subscription qw(subscribe); my $result = subscribe($schema, $doc, $root_value); DESCRIPTIONImplements a GraphQL "subscription" - a feed of events, commonly of others' mutations.METHODSsubscribemy $result = subscribe( $schema, $doc, # can also be AST $root_value, $context_value, $variable_values, $operation_name, $field_resolver, $promise_code, $subscribe_resolver, ); Takes the same args as "execute" in GraphQL::Execution, except that the $promise_code is mandatory, and there is the optional $subscribe_resolver which, supplied or not, will be used instead of the $field_resolver to resolve the initial subscription. The $field_resolver will still be used for resolving each result. Returns a promise of either:
The event source returns values by using "publish" in GraphQL::AsyncIterator. To communicate errors, resolvers can throw errors in the normal way, or at the top level, use "error" in GraphQL::AsyncIterator. The values will be resolved in the normal GraphQL fashion, including that if there is no specific-to-field resolver, it must be a value acceptable to the supplied or default field-resolver, typically a hash-ref with a key of the field's name.
Visit the GSP FreeBSD Man Page Interface. |