Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Private 如何让拉威尔收听私人推送频道?_Private_Laravel 5.4_Pusher_Broadcasting_Laravel Echo - Fatal编程技术网

Private 如何让拉威尔收听私人推送频道?

Private 如何让拉威尔收听私人推送频道?,private,laravel-5.4,pusher,broadcasting,laravel-echo,Private,Laravel 5.4,Pusher,Broadcasting,Laravel Echo,我读了一些其他类似的问题,但没有找到满意的答案,所以我只是用我在代码中所做的再次提问 在resources/assets/bootstrap.js中,我有 window.Echo = new Echo({ broadcaster: 'pusher', key: '8c5cc1d9fe77464ac2df', cluster: 'us2', encrypted: true, authEndpoint: '/chat4/public/authenticate-

我读了一些其他类似的问题,但没有找到满意的答案,所以我只是用我在代码中所做的再次提问

在resources/assets/bootstrap.js中,我有

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: '8c5cc1d9fe77464ac2df',
    cluster: 'us2',
    encrypted: true,
    authEndpoint: '/chat4/public/authenticate-broadcasting',
});
在我的routes/web.php中,我有:

Route::post('/authenticate-broadcasting', function () {
  return true;
});
但当我加载应用程序页面时,在控制台中我得到:

POST http://laraveldemo-one.com/chat4/public/authenticate-broadcasting 500 (Internal Server Error)

Pusher : Couldn't get auth info from your webapp : 500
我正确安装了Laravel Echo和Pusher,因为如果我使用公共频道,我的应用程序工作得很好,但我使用私人频道失败得很惨,我不确定我还能尝试什么,因为我已经阅读了几次文档,找不到我缺少的任何东西。请帮帮我!:)

您必须发送csrf\u令牌 您可以通过meta标记或Echo json参数发送 认证:{ 标题:{ “X-CSRF-Token”:“一些CSRF-Token” } }

您必须发送csrf\u令牌 您可以通过meta标记或Echo json参数发送 认证:{ 标题:{ “X-CSRF-Token”:“一些CSRF-Token” } }