我已经使用Brodecast + Vue在laravel中创建了聊天应用程序,因此在尝试我的测试广播类时,它会在PusherBroadcaster.php(第106行)中收到错误" BroadcastException" 我已经仔细检查了所有配置并且api身份验证是正确的。但是获取错误和推送调试控制台不显示和请求。
司机:
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => 'ap1',
'encrypted' => true
],
],
事件:
public $message;
public $user;
public function __construct($message, User $user)
{
$this->message = $message;
$this->user = $user;
}
测试功能:
public function test()
{
$user = User::find(Auth::id());
event(new ChatEvent('Hello pusher', $user));
return response('done');
}
答案 0 :(得分:0)
我认为你需要加密=假。
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => 'ap1',
'encrypted' => false
],
],