GraphQL::PubSub(3pm) | User Contributed Perl Documentation | GraphQL::PubSub(3pm) |
GraphQL::PubSub - publish/subscribe
use GraphQL::PubSub; my $pubsub = GraphQL::PubSub->new; $pubsub->subscribe('channel1', \&callback); $pubsub->publish('channel1', 1); $pubsub->unsubscribe('channel1', \&callback);
Encapsulates the publish/subscribe logic needed by GraphQL::Subscription.
Registers the given callback on the given channel.
The optional second "error" callback is called as a method on the object when an exception is thrown by the first callback. If not given, the default is for the subscription to be cancelled with "unsubscribe". The error callback will be called with values of the channel, the original callback (to enable unsubscribing), the exception thrown, then the values passed to the original callback. Any exceptions will be ignored.
Removes the given callback from the given channel.
Calls each callback registered on the given channel, with the given values.
2022-03-27 | perl v5.34.0 |