Pusher雄辩事件触发器返回错误的HTTP API Req Laravel 5.7

Pusher雄辩事件触发器返回错误的HTTP API Req Laravel 5.7,laravel,api,events,eloquent,pusher,Laravel,Api,Events,Eloquent,Pusher,我有两个由API执行的雄辩的模型事件(插入和更新)。我已经和邮递员一起测试过了,他们正在工作,我正在获取操作日志。我已经删除了日志,因为我的目标是在触发其中一个事件时触发pusher事件。我已经设置了pusher从作曲家那里安装了它。我已经更新了配置文件和env,我将在下面展示,并且我已经从pusher仪表板对通道进行了一些触发 我在apache、laravel 5.7上使用Ubuntu18.04,在尝试HTTP请求时,我注意到$re=$pusher->trigger('api-channel'

我有两个由API执行的雄辩的模型事件(插入和更新)。我已经和邮递员一起测试过了,他们正在工作,我正在获取操作日志。我已经删除了日志,因为我的目标是在触发其中一个事件时触发pusher事件。我已经设置了pusher从作曲家那里安装了它。我已经更新了配置文件和env,我将在下面展示,并且我已经从pusher仪表板对通道进行了一些触发

我在apache、laravel 5.7上使用Ubuntu18.04,在尝试HTTP请求时,我注意到$re=$pusher->trigger('api-channel','model.insert',array('message'=>'hello');返回false。我试过在配置中注释加密行并将其设置为false,按照其他帖子的建议通过ntp更新时间,但这些都不能解决我的问题。我尝试从控制器和eventserviceprovider引导函数触发事件,但结果总是一样的

这是我的js

//event listener for document repo api
// Enable pusher logging - don't include this in production
Pusher.logToConsole = true;

var pusher = new Pusher('*****', {
   cluster: 'eu',
   forceTLS: true
});

var channel = pusher.subscribe('api-channel');



channel.bind('model.insert', function(document) {
   alert(JSON.stringify(document.message));
   console.log(document);

});
通过在BroadCastManager.php中添加这些代码行,我已经测试了配置是否正确设置

var_dump($config['key']);
var_dump($config['secret']);
var_dump( $config['app_id']);
var_dump($config['options']);
exit;
从输出中我可以看出它们是正确的。 这是我尝试从控制器触发时的代码

namespace App\Http\Controllers;

.
.
.
use Illuminate\Http\Request;
use Pusher\Pusher as Pusher;

.
.
.
            if ($model->save()) {


                $options = array(
                    'cluster' => 'eu',
                    'encrypted' => false
//                'host' => '127.0.0.1',
//                'port' => 6001,
//                'scheme' => 'http'
                );
                $pusher = new Pusher(
                    'key',
                    'secret',
                    'app-id',
                    $options
                );

//                dd($pusher->get_channels());




                $re = $pusher->trigger('api-channel', 'model.insert', array('message' => 'hello'));

                dd($re);

                return new ModelResource($model);
            }
event(new ModelEvent(new ModelRepository()));
我还尝试创建一个laravel事件和侦听器,并在执行模型更改后在控制器中触发该事件。在这种情况下,我会得到以下错误:

    "message": "",
    "exception": "Illuminate\\Broadcasting\\BroadcastException",
    "file": "/home/usr/projects/tdv/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php",
    "line": 117,
    "trace": [
        {
            "file": "/home/usr/projects/tdv/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php",
            "line": 48,
            "function": "broadcast",
            "class": "Illuminate\\Broadcasting\\Broadcasters\\PusherBroadcaster",
            "type": "->"
这是我的活动课。它已在事件服务提供商中注册


namespace App\Events;

use App\ModelRepository;
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;
use Log;

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


    public $modelRepository;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct(ModelRepository $modelRepository)
    {
        //
        $this->$modelRepository = $modelRepository;
        $this->broadcast();
    }



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

    public function broadcast()
    {
        $options = array(
            'cluster' => 'eu',
            'host' => '127.0.0.1',
            'port' => 6001,
            'scheme' => 'http',
            'useTLS' => true
        );
        $pusher = new Pusher(
            '***',
            '***',
            '***',
            $options
        );

        return $pusher->trigger('api-channel', 'model.insert', array('data' => $this->modelRepository));

    }
}
在这种情况下,这就是我在控制器中触发事件的方式

namespace App\Http\Controllers;

.
.
.
use Illuminate\Http\Request;
use Pusher\Pusher as Pusher;

.
.
.
            if ($model->save()) {


                $options = array(
                    'cluster' => 'eu',
                    'encrypted' => false
//                'host' => '127.0.0.1',
//                'port' => 6001,
//                'scheme' => 'http'
                );
                $pusher = new Pusher(
                    'key',
                    'secret',
                    'app-id',
                    $options
                );

//                dd($pusher->get_channels());




                $re = $pusher->trigger('api-channel', 'model.insert', array('message' => 'hello'));

                dd($re);

                return new ModelResource($model);
            }
event(new ModelEvent(new ModelRepository()));
提前感谢!:)