相关疑难解决方法(0)

异常:Illuminate \ Broadcasting \ BroadcastException PusherBroadcaster.php 中没有消息:119

拉拉维尔 5.8

我对整个推送功能很陌生,我一直在遵循本教程并尝试它,

使用 Laravel 和 Pusher Channels 创建 Web 通知

我已经一步一步地进行了操作,当我到达通过访问测试网址手动测试事件的步骤时,我收到以下异常:

照亮\广播\广播异常 无消息

C:\wamp\www\ares\vendor\laravel\framework\src\Illuminate\Broadcasting\Broadcasters\PusherBroadcaster.php

这是代码:

    $response = $this->pusher->trigger(
        $this->formatChannels($channels), $event, $payload, $socket, true
    );

    if ((is_array($response) && $response['status'] >= 200 && $response['status'] <= 299)
        || $response === true) {
        return;
    }

    throw new BroadcastException( // <-- Exception at this line
        is_bool($response) ? 'Failed to connect to Pusher.' : $response['body']
    );
}

/**
 * Get the Pusher SDK instance.
 *
 * @return \Pusher\Pusher
 */
public function getPusher()
{
    return …
Run Code Online (Sandbox Code Playgroud)

php pusher laravel-5

3
推荐指数
1
解决办法
9099
查看次数

Laravel pusher Illuminate\Broadcasting\BroadcastException没有消息

我'使用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;
    } 
Run Code Online (Sandbox Code Playgroud)

在AdvertisingAdded

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 …
Run Code Online (Sandbox Code Playgroud)

broadcasting laravel pusher

2
推荐指数
2
解决办法
4302
查看次数

标签 统计

pusher ×2

broadcasting ×1

laravel ×1

laravel-5 ×1

php ×1