http://localhost:8000/broadcasting/auth 404 (Not Found)

余生颓废 提交于 2020-11-27 04:49:26

问题


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/auth 404 (Not Found)

What maybe the cause of the error and how to resolve it.


回答1:


Look in config/app.php if you have uncommented

App\Providers\BroadcastServiceProvider::class,




回答2:


There are two Service Providers with Same name but different namespace in config/app.php

Illuminate\Broadcasting\BroadcastServiceProvider::class,

App\Providers\BroadcastServiceProvider::class,

So uncomment both of them. It will work.




回答3:


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
});



回答4:


Complete These Steps

1) In config/app.php uncomment this line-

App\Providers\BroadcastServiceProvider::class,

2) If above not work and 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).

It'll solve your issue and since you can also pass additional auth parameters as your need in app\Providers\BroadcastServiceProvider.php

Broadcast::routes(['middleware' => 'auth:admin']);



回答5:


Are you missing csrf_token() in your blade file?

You can add in the meta tag

<meta name="csrf-token" content="{{ csrf_token() }}">

Check out your BroadcastServiceProvider.php and you should include your channel routes in the boot method.



来源:https://stackoverflow.com/questions/41704428/http-localhost8000-broadcasting-auth-404-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!