You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What problem does this feature proposal attempt to solve?
When broadcasting subscriptions you can filter out the user that triggered the broadcast with:
The problem comes when the broadcast is queued instead of dispatching it synchronously, when queued request() is always empty and the filter will be ignorred.
Which possible solutions should be considered?
One solution could be passing the request to the BroadcastSubscriptionJob and setting it on execution:
useIlluminate\Support\Facades\App;
useIlluminate\Support\Facades\Facade;
classBroadcastSubscriptionJobimplementsShouldQueue
{
useQueueable;
useSerializesModels;
publicfunction__construct(
/** * The subscription field that was requested. */publicGraphQLSubscription$subscription,
/** * The name of the field. */publicstring$fieldName,
/** * The root element to be passed when resolving the subscription. */publicmixed$root,
/** * The request context when the broadcast was triggered */publicRequest$request,
) {}
publicfunctionhandle(BroadcastsSubscriptions$broadcaster): void
{
App::instance('request', $this->request);
Facade::clearResolvedInstance('request');
$broadcaster->broadcast($this->subscription, $this->fieldName, $this->root);
}
}
Other solution could be adding a "native" toOthers functionality to the broadcaster:
What problem does this feature proposal attempt to solve?
When broadcasting subscriptions you can filter out the user that triggered the broadcast with:
The problem comes when the broadcast is queued instead of dispatching it synchronously, when queued
request()
is always empty and the filter will be ignorred.Which possible solutions should be considered?
One solution could be passing the request to the
BroadcastSubscriptionJob
and setting it on execution:Other solution could be adding a "native"
toOthers
functionality to the broadcaster:The problem with this solution is that it could break compatibility with the
BroadcastsSubscriptions
interface.The text was updated successfully, but these errors were encountered: