I'm trying to implement a notification system with Laravel and Vue JS. I implemented everything and it needs to be work but Notification class is not broadcasting.
.env file
BROADCAST_DRIVER=pusher
PUSHER_APP_ID=40xxxx
PUSHER_KEY=5a6axxxxxx
PUSHER_SECRET=b35xxxxxx
Already run those commands below:
npm install --save laravel-echo pusher-js
composer require pusher/pusher-php-server "~2.6"
in app.js (uncommented)
App\Providers\BroadcastServiceProvider::class,
BroadcastServiceProvider.php
Broadcast::channel('App.User.*', function ($user, $userID) {
return (int) $user->id === (int) $userID;
});
bootstrap.js
import Echo from "laravel-echo"
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
key: '5a6axxxxxx',
cluster: 'eu',
encrypted: true,
authEndpoint: "/broadcasting/auth"
});
window.Pusher.log = function(message){
window.console.log(message);
}
window.Echo.private('App.User.1')
.notification((notification) => {
console.log(notification.type);
});
No errors in Laravel log. In the parallel, I am checking on Pusher's Debug Console only connect and disconnect requests on there. Why it's not pushing any kind of error and why it's not working properly?