Laravel Spark没有向Pusher发送消息

时间:2017-08-01 16:52:48

标签: laravel laravel-5 pusher

试图让Pusher在我的应用上运行,但无法让它向Pusher本身发送任何消息。

我在创建'预订'

时会触发一个事件
event(new BookingCreated($booking));

此事件:

<?php

namespace App\Events\Booking;

use App\Booking;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class BookingCreated implements ShouldBroadcast
{
    use SerializesModels, InteractsWithSockets;

    public $booking;

    /**
     * Create a new event instance.
     *
     * @param Booking  $booking
     * @return void
     */
    public function __construct(Booking $booking)
    {
        $this->booking = $booking;
    }

    public function broadcastOn()
    {
        return ['teams.'.$this->booking->team_id.'.bookings'];
    }
}

我的env文件包含以下内容(详细信息):

BROADCAST_DRIVER=pusher
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

我的广播配置文件将推送器详细信息设置为:

'pusher' => [
    'driver' => 'pusher',
    'key' => env('PUSHER_APP_KEY'),
    'secret' => env('PUSHER_APP_SECRET'),
    'app_id' => env('PUSHER_APP_ID'),
    'options' => [
        'cluster' => 'eu'
    ],
],

查看Pusher仪表板时,我可以看到打开的连接,但没有消息。我正在运行队列:listen显示正在处理事件。

我缺少什么?

1 个答案:

答案 0 :(得分:0)

这是我的错误,我更改了env文件BROADCAST_DRIVER,但没有重新启动队列侦听器,因此我的事件正在向日志广播。