Laravel pusher Illuminate \ Broadcasting \ BroadcastException 没有消息

Laravel pusher Illuminate \ Broadcasting \ BroadcastException No message

我正在使用 Laravel 5.5 和推送器进行实时通知,通知来自 Api
在我完成配置后
在 Api

     public function store(Request $request)
    { 
         $advertising = Advertising::create($request->all()); 
         $admins = \App\Admin::all();
        \Notification::send( $admins, new \App\Notifications\AdvertisingAdded($advertising) );

         return $advertising;
    } 

已添加广告

namespace App\Notifications;

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

use Illuminate\Notifications\Messages\BroadcastMessage;
use App\Advertising;

class AdvertisingAdded extends Notification
{
    use Queueable;

    //-must be public fir pusher
    public $advertising;

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


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


    public function toArray($notifiable)
    {
        return [
            'msg' => 'Advertising '.$this->advertising->title_ar.' is added ',
            'advertising_id' => $this->advertising->id
        ];
    }

    public function toBroadcast($notifiable)
    {
        return new BroadcastMessage([
            'msg' => 'Advertising '.$this->advertising->title_ar.' is added ',
            'advertising_id' => $this->advertising->id
        ]);
    }
}

当我从 postman post 那里得到一个错误

Illuminate \ Broadcasting \ BroadcastException No message error image

我关注了这个视频https://www.youtube.com/watch?v=i6Rdkv-DLwk

我通过以下方式解决了我的问题:进行加密:false

将 curl 选项添加到 broadcasting.php

`'pusher' => [
                'driver' => 'pusher',
                'key' => env('PUSHER_APP_KEY'),
                'secret' => env('PUSHER_APP_SECRET'),
                'app_id' => env('PUSHER_APP_ID'),
                'options' => [
                    'cluster' => env('PUSHER_APP_CLUSTER'),
                    'encrypted' => true,
                    'curl_options' => [
                        CURLOPT_SSL_VERIFYHOST => 0,
                        CURLOPT_SSL_VERIFYPEER => 0,
                    ]
                ],`

我通过设置 .env 文件解决了我的问题

设置:

APP_URL=http://localhost
DB_HOST=localhost

和运行

php artisan config:cache

我解决了这个问题。在 config/broadcasting.php 中使用此代码

'options' => [
'cluster' => 'eu',
'useTLS' => false
],

使useTLS为假

在 laravel 7 中,如下配置为 config/broadcasting。php 和 运行 artisan 命令 cache:clear。帮我解决了。

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