src/Subscriptions/SubscriptionBroadcaster.php
public function broadcast(GraphQLSubscription $subscription, string $fieldName, $root): void
    {
        $topic = $subscription->decodeTopic($fieldName, $root);

        $subscribers = $this->storage
            ->subscribersByTopic($topic)
            ->filter(function (Subscriber $subscriber) use ($subscription, $root): bool {
                return $subscription->filter($subscriber, $root);
            });

        $this->iterator->process(
            $subscribers,
            function (Subscriber $subscriber) use ($root): void {
                $data = $this->graphQL->executeQuery(
                    $subscriber->query,
                    $subscriber->context,
                    $subscriber->args,
                    $subscriber->setRoot($root),
                    $subscriber->operationName
                );

                $this->broadcastManager->broadcast(
                    $subscriber,
                    $data->jsonSerialize()
                );
            }
        );
    }
public function broadcast(GraphQLSubscription $subscription, string $fieldName, $root): void
    {
        $topic = $subscription->decodeTopic($fieldName, $root);

        $subscribers = $this->storage
            ->subscribersByTopic($topic)
            ->filter(function (Subscriber $subscriber) use ($subscription, $root): bool {
                return $subscription->filter($subscriber, $root);
            });

        $this->iterator->process(
            $subscribers,
            function (Subscriber $subscriber) use ($root): void {
                $data = $this->graphQL->executeQuery(
                    $subscriber->query,
                    $subscriber->context,
                    $subscriber->args,
                    $subscriber->setRoot($root),
                    $subscriber->operationName
                );

                $this->broadcastManager->broadcast(
                    $subscriber,
                    $data->jsonSerialize()
                );
            }
        );
    }
public function broadcast ( GraphQLSubscription $ subscription , string $ fieldName , $ root ) : void { $ topic = $ subscription -> decodeTopic ( $ fieldName , $ root ) ; $ subscribers = $ this -> storage -> subscribersByTopic ( $ topic ) -> filter ( function ( Subscriber $ subscriber ) use ( $ subscription , $ root ) : bool { return $ subscription -> filter ( $ subscriber , $ root ) ; } ) ; $ this -> iterator -> process ( $ subscribers , function ( Subscriber $ subscriber ) use ( $ root ) : void { $ data = $ this -> graphQL -> executeQuery ( $ subscriber -> query , $ subscriber -> context , $ subscriber -> args , $ subscriber -> setRoot ( $ root ) , $ subscriber -> operationName ) ; $ this -> broadcastManager -> broadcast ( $ subscriber , $ data -> jsonSerialize ( ) ) ; } ) ; }
Push subscription data to subscribers.

@param  \Nuwave\Lighthouse\Schema\Types\GraphQLSubscription  $subscription
@param  string  $fieldName
@param  mixed  $root
@return void
Push subscription data to subscribers .