vendredi 2 décembre 2016

Laravel Broadcast Pusher Event Firing Multiple Times

I have this Laravel 5.1 Event that I fire when a chat is stored. But it is creating multiple broadcasts to Pusher

<?php namespace App\Events;

use App\Events\Event;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;

class ChatSent extends Event implements ShouldBroadcast
{
    use SerializesModels;

    public $channel;
    public $chat;

    public function __construct($channel,$chat)
    {
        $this->channel = $channel;
        $this->chat = $chat;
    }

    public function broadcastOn()
    {
        return ['private-'.$this->channel];
    }
}

I am using Supervisor (supervisord) with multiple workers... not sure if that makes a difference... here's the laravel.conf:

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/app/artisan queue:work database --sleep=3 --tries=3 --daemon
autostart=true
autorestart=true
user=ubuntu
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/app/worker.log

Any idea why this may be happening?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire