Laravel广播没有发送推送消息

时间:2020-04-23 14:46:27

标签: laravel laravel-5

我创建了一个实现了shouldBrodcast的事件,在我的本地计算机上,Web applecation和pusher都在工作,并且正在正确执行该事件,并且正在接收API消息,但是在其他计算机上,该事件似乎并没有被执行,因为我什么也没有收到,甚至没有收到错误。 应该执行php artisan queue:listen而不是php artisan:work来执行shouldBrodcastshouldBrodcastNow之类的东西吗?

我的活动:

<?php

namespace axv\dr\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class msgsnd implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public $msg;
    private $channel_id;

    public function __construct($channel_id, $msg)
    {
        //
        $this->msg = $msg;
        $this->chat_id = $channel_id;

    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('msging-'.$this->channel_id);
    }
}

然后我将路径设置为控制器功能:

event(new msgsnd(5, 'hello'));

我没有编辑队列配置,也没有运行php artisan qeue:listen

使用本地计算机时,我在pusher调试控制台上接收到该事件,但是,在另一台计算机上,我什至没有收到一个错误。

0 个答案:

没有答案