I'm trying to use Laravel's notification class to send a system notification upon an action. I'm receiving notifications when sync driver is being used, but when I switch to redis queue connection, there is no payload through pusher.
SystemNotification.php
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Channels\BroadcastChannel;
use Illuminate\Notifications\Messages\BroadcastMessage;
use Illuminate\Notifications\Notification;
class SystemNotification extends Notification implements ShouldQueue
{
use Queueable;
private $event;
private $eventData;
public function __construct($event, $eventData) {
$this->event = $event;
$this->eventData = $eventData;
}
/**
* Get the delivery channels for this Notification.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable) {
return [BroadcastChannel::class];
}
public function toBroadcast($notifiable) {
return (new BroadcastMessage([
'event' => $this->event,
]));
}
}
.env
BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
QUEUE_CONNECTION=redis
SESSION_DRIVER=file
SESSION_LIFETIME=120
queue.php
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
],
Here is the payload when I use sync driver.
My job is also being successfully processed.
I would appreciate any and all the help. Thanks!