Laravel Echo & Pusher status code 200 but frontend no notification
I’m trying to broadcast notifications via a private channel to my web application for users who are logged in. I set up Laravel Echo and Pusher. When I test with php artisan tinker, I can see data in the debug console of Pusher-JS. I checked Telescope, and the status for [post] /broadcasting/auth is 200. However, despite all this, the frontend doesn’t display the notifications. Any suggestions on how to troubleshoot this issue would be greatly appreciated!
I ensure that App\Providers\BroadcastServiceProvider::class is not commented.
(Laravel 11) .env: BROADCAST_CONNECTION=pusher
AlertMenu.tsx:
window.Pusher = Pusher;
const echo = new Echo({
broadcaster: 'pusher',
key: "xxxxxxxxxxxxxxx",
cluster: "mt1",
forceTLS: true,
});
AlertEvent.php: new PrivateChannel('project.'.$project_id.'.alerts');
BroadcastServiceProvider.php:
public function boot(): void
{
Broadcast::routes();
require base_path('routes/channels.php');
}
channels.php:
Broadcast::channel('project.{project_id}.alerts', function ($user, $project_id) {
if($user->current_project_id == $project_id){
return true;
}else{
return false;
}
}
Please or to participate in this conversation.