laravel http://localhost:8000/broadcasting/auth 404(未找到)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41704428/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
http://localhost:8000/broadcasting/auth 404 (Not Found)
提问by YaSh Chaudhary
I am trying to make my app app connect to pusher on a private channel.
我正在尝试让我的应用程序连接到私人频道上的推送器。
But I am getting the following error:
但我收到以下错误:
pusher.js?b3eb:593 POST http://localhost:8000/broadcasting/auth404 (Not Found)
pusher.js?b3eb:593 POST http://localhost:8000/broadcasting/auth404(未找到)
What maybe the cause of the error and how to resolve it.
错误的原因可能是什么以及如何解决它。
回答by Eugene van der Merwe
Look in config/app.php if you have uncommented
如果您取消注释,请查看 config/app.php
App\Providers\BroadcastServiceProvider::class,
App\Providers\BroadcastServiceProvider::class,
回答by Prathamesh Palav
There are two Service Providers with Same name but different namespace in config/app.php
config/app.php 中有两个名称相同但命名空间不同的服务提供者
Illuminate\Broadcasting\BroadcastServiceProvider::class,
App\Providers\BroadcastServiceProvider::class,
So uncomment both of them. It will work.
所以取消他们两个的注释。它会起作用。
回答by Muthu17
Hope your base url is wrong try to hardcore your base url like below
希望你的基本网址是错误的,试着像下面那样硬核你的基本网址
window.Echo = new Echo({
authEndpoint : 'http://*******/public/broadcasting/auth',
broadcaster: 'pusher',
key: '********',
cluster: '***',
encrypted: true
});
回答by Maniruzzaman Akash
Complete These Steps
完成这些步骤
1)In config/app.php
uncomment this line-
1)在config/app.php
取消注释这一行 -
App\Providers\BroadcastServiceProvider::class,
2)If above not workand still you've got the error - then I'm sure you are not logged in. Just login to your account and check(because it's your private broadcast).
2)如果上述方法不起作用,但您仍然遇到错误 - 那么我确定您没有登录。只需登录您的帐户并检查(因为这是您的私人广播)。
It'll solve your issue and since you can also pass additional auth parameters as your need in app\Providers\BroadcastServiceProvider.php
它将解决您的问题,因为您还可以根据需要传递其他身份验证参数 app\Providers\BroadcastServiceProvider.php
Broadcast::routes(['middleware' => 'auth:admin']);
回答by Rutvij Kothari
Are you missing csrf_token() in your blade file?
您的刀片文件中是否缺少 csrf_token() ?
You can add in the meta tag
您可以添加元标记
<meta name="csrf-token" content="{{ csrf_token() }}">
Check out your BroadcastServiceProvider.phpand you should include your channel routes in the boot method.
查看您的BroadcastServiceProvider.php,您应该在引导方法中包含您的频道路由。