-
-
Notifications
You must be signed in to change notification settings - Fork 466
Description
Describe the bug
I was trying to figure out the subscription with the echo driver. I found the following things are wrongly done.
- Package generates a unique private channel to listen to as named
private-*
lighthouse/src/Subscriptions/Subscriber.php
Lines 170 to 173 in dba839e
public static function uniqueChannelName(): string { return 'private-lighthouse-'.Str::random(32).'-'.time(); }
But when broadcasting, it then broadcasts to a presence channel. which prepends presensce- to the channel making presence-private-lighthouse-*. So, it should always be handled as a presence channel?
lighthouse/src/Subscriptions/Events/EchoSubscriptionEvent.php
Lines 29 to 32 in dba839e
| public function broadcastOn(): PresenceChannel | |
| { | |
| return new PresenceChannel($this->channel); | |
| } |
-
Is it intentional to keep separate event names?
return 'lighthouse.subscription';
public const EVENT_NAME = 'lighthouse-subscription'; -
Even if user wants to publish the subscription data in
sync, it gets pushed to the queue.
Line 313 in dba839e
'queue_broadcasts' => env('LIGHTHOUSE_QUEUE_BROADCASTS', true),
Because, it usesShouldBroadcast, which is pushed to the queue. It should beShouldBroadcastNowto send it in sync manner.
class EchoSubscriptionEvent implements ShouldBroadcast -
To broadcast a message through the
echodriver, it requires to installilluminate/broadcastingpackage when using Laravel. If using pusher, it's not required. It's not mentioned in the documentation.
Lighthouse Version: * v5.1.0