Search code examples
phplaravelnotificationsbroadcastpusher

Pusher not working, no push notifications, is echo working at all?


I followed this tutorial to understand how to implement realtime notifications:

https://www.sitepoint.com/add-real-time-notifications-laravel-pusher/

I set up the simple-blog new project as in the instructions and was able to make notifications work, however the last step, pusher, doesn't work. I also tried to clone the entire repo thinking maybe I was making some mistake in code but it doesn't work either. Of course I set up my pusher app and put keys etc in .env and in javascript. Can anyone try to clone that and see if it's working? I can't seem to find what the problem is here.

I already tried to start the queue with php artisan queue:work and php artisan queue:listen

This is the channel route:

use Illuminate\Support\Facades\Broadcast;

Broadcast::channel('App.User.{id}', function ($user, $id) {
    return (int) $user->id === (int) $id;
});

App\Providers\BroadcastServiceProvider::class, in config/app.php is set

I don't know why it's not working. Any clue?


Solution

  • Make sure to set your BROADCAST_DRIVER=pusher in your .env