In the job, are you referencing the request or the current user? IE something that is not available when the job is processed by a queue worker?
Jul 9, 2024
2
Level 2
Broadcasted Notifications are completed in Horizon, but not handled by Reverb
I've installed and configured Laravel Reverb & Echo. It all works fine with Laravel Events that implement ShouldBroadcastNow, and with traditional Laravel notification classes that use sync as the connection:
public function toBroadcast(object $notifiable): BroadcastMessage
{
$data = [
'order_id' => $this->order->id,
'amount' => 123,
];
return (new BroadcastMessage($data))->onConnection('sync');
}
But when I use ShouldBroadcast instead of ShouldBroadcastNow in the Event, or remove the ->onConnection('sync'); part from the Notification, it doesn't work anymore.
The jobs BroadcastNotificationCreated are succesfuly handled by the queue, but nothing happens in Reverb (which I check using php artisan reverb:start --debug). While I'm subscribed to the channel:
Message Received ............................................................................................................. 634877862.511807337
1▕ {
2▕ "event": "pusher:subscribe",
3▕ "data": {
4▕ "auth": "sgu7kglqvanjdymzkagp:a61791396adc789f0954bf8b029e9b894165915f32721b0b48c56ecb011aba3a",
5▕ "channel": "private-users.1"
6▕ }
7▕ }
Message Handled .............................................................................................................. 634877862.511807337
Any suggestions?
Please or to participate in this conversation.