GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
GraphQL::Subscription(3) User Contributed Perl Documentation GraphQL::Subscription(3)

GraphQL::Subscription - Implement GraphQL subscriptions

  use GraphQL::Subscription qw(subscribe);
  my $result = subscribe($schema, $doc, $root_value);

Implements a GraphQL "subscription" - a feed of events, commonly of others' mutations.

  my $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:

  • an error result if the subscription fails (generated by GraphQL)
  • a GraphQL::AsyncIterator instance generated by a resolver, probably hooked up to a GraphQL::PubSub instance

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.

2021-07-04 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.