30

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.

YaSh Chaudhary
  • 2,605
  • 8
  • 37
  • 74
  • 1
    You need to set up an HTTP server running on `localhost:8000` which can handle requests to `/broadcasting/auth`. The Pusher server libraries provide helper functions for handling these requests. – Will Sewell Jan 18 '17 at 11:13
  • 1
    Have you resolved the isssue? I have both `BroadcastServiceProvider` classes uncommented in th `config/app`. Have cleared compiled services , config cache and route cache. Still doesn't work. – The_ehT Dec 30 '17 at 17:01
  • @The_ehT use public channel and use auth middleware on it – YaSh Chaudhary Dec 30 '17 at 17:07
  • I had the same error and got stuck on it for about 2 hours. Turns out it was my local host i set up a virtual host in my xammp vhosts file and the error disappeared. – Jelly Bean Nov 16 '18 at 10:34

6 Answers6

99

Look in config/app.php if you have uncommented

App\Providers\BroadcastServiceProvider::class,

Eugene van der Merwe
  • 4,390
  • 1
  • 35
  • 48
22

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.

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
19

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
});
Muthu17
  • 1,481
  • 12
  • 20
13

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']);
Maniruzzaman Akash
  • 4,610
  • 1
  • 37
  • 34
1

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.

Rutvij Kothari
  • 1,253
  • 11
  • 22
1

UnComment this line in config/app.php :

App\Providers\BroadcastServiceProvider::class,

and sure cache is clear with :

php artisan config:cache

Done...

Amir Kaftari
  • 1,305
  • 14
  • 13