我无法通过“推动”驱动程序在Laravel中触发事件

时间:2019-12-16 09:36:59

标签: laravel exception events broadcast pusher

我在环境文件中设置了按键:

PUSHER_APP_ID=9****3
PUSHER_APP_KEY=ed96c7a********8bec0
PUSHER_APP_SECRET=89f050********43176a
PUSHER_APP_CLUSTER=eu

创建MyEvent类:

class MyEvent implements ShouldBroadcast {

    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $message;

    public function __construct( $message )
    {
        $this->message = $message;
    }

    public function broadcastOn()
    {
        return [ 'my-channel' ];
    }

    public function broadcastAs()
    {
        return 'my-event';
    }

}

并在控制器调用event(new MyEvent('Hello');中。但我收到此错误:

Illuminate\Broadcasting\BroadcastException
Illuminate\Broadcasting\Broadcasters\PusherBroadcaster::broadcast
line :119

我需要用于创建实时通知模块的事件。我有这个错误。 我该如何解决?

0 个答案:

没有答案