Notifications 错误:Laravel通知广播异常

Notifications 错误:Laravel通知广播异常,notifications,laravel-5.4,pusher,Notifications,Laravel 5.4,Pusher,我正在尝试在我正在开发的应用程序中构建一个实时通知系统。其中一个要求是,当ID过期时,应向该特定用户发送通知。由于此任务最多需要每天运行,因此我开发了一个artisan命令,该命令易于与CRON作业(即Laravel Scheduler)一起运行。一切正常,即artisan命令运行,通知生成并存储在数据库和所有相关内容中。但是每次生成通知时,页面都需要重新加载,这就是我被卡住的地方。我试图让它在实时发生,但一个非常奇怪的错误被抛出&我不知道这意味着什么 以下是必要的代码: Artisan.fil

我正在尝试在我正在开发的应用程序中构建一个实时通知系统。其中一个要求是,当ID过期时,应向该特定用户发送通知。由于此任务最多需要每天运行,因此我开发了一个artisan命令,该命令易于与CRON作业(即Laravel Scheduler)一起运行。一切正常,即artisan命令运行,通知生成并存储在数据库和所有相关内容中。但是每次生成通知时,页面都需要重新加载,这就是我被卡住的地方。我试图让它在实时发生,但一个非常奇怪的错误被抛出&我不知道这意味着什么

以下是必要的代码:

Artisan.file
注意:每当我重新加载页面时,Pusher控制台都会显示相应的日志式连接的专用通道和主机&所有这些东西都意味着问题不在客户端,(但是)

刚刚找到了这个问题的答案


必须加密
false
,因为我正在本地开发

Hi Lahori,通常
加密:true
在本地开发时工作正常。你用的是像Fiddler这样的东西吗?我不明白你指的是什么,但我用的是开发。
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

use App\User;
use Carbon\Carbon;
use App\Notifications\UserIdExpired;

class UpdateCatalog extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'check:expiry';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'dummy command to check its purpose';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $ZERO = 0;
        $MONTH = 30;
        $today = Carbon::today();
        $users = User::all();
        foreach($users as $user){
            $today = Carbon::today();
            $expiryDate = $user->qidexpire_on;

            if($today->diffInDays($expiryDate, false) <= $MONTH && $today->diffInDays($expiryDate, false) >= $ZERO){
               $this->info($user);
                $this->info($expiryDate->diffInDays($today));
                $user->notify(new UserIdExpired);

            } else {


            } 
            }

        }
    }
}
<?php

namespace App\Notifications;

use Carbon\Carbon;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\BroadcastMessage;


class UserIdExpired extends Notification
{
    use Queueable;


    public function via($notifiable)
    {
        return ['database', 'broadcast'];
    }

    public function toDatabase($notifiable)
    {
        return [
            'user' => $notifiable,
            'id_expired' => Carbon::now()
        ];
    }

    public function toBroadcast($notifiable)
    {
        return new BroadcastMessage([
            'user' => $notifiable,
            'id_expired' => Carbon::now()
        ]);
    }


}
[Illuminate\Broadcasting\BroadcastException]