0

I got response into Pusher but the issue is I' m not able to receive the notification in my console.

Main.js

// Broadcasting realtime notification
import Echo from 'laravel-echo';
import Pushar from 'pusher-js';

window.Pusher = Pushar;

window.Echo = new Echo({
  broadcaster: 'pusher',
  key: import.meta.env.VITE_PUSHER_APP_KEY,
  cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER,
  wsHost: window.location.hostname,
  // wsPort: 6001,
  disableStats: true,
  forceTLS: false
});

Component.vue

export default {
    mounted() {
      Echo.private('App.Models.User.1', {headers: {Authorization: 'Bearer ' + token},} )
      .notification((notification) => {
            console.log(notification);
      });
    },
}

TestNotification.php

return ['database', 'broadcast'];
public function toBroadcast($notifiable)
{
    return [
        'subject' => $this->data['subject'],
        'count' => $notifiable->unreadNotifications->count(),
    ];
}

Pusher Response:

Channel: private-App.Models.User.1, Event: Illuminate\Notifications\Events\BroadcastNotificationCreated
{
  "subject": "Let's Join class today",
  "count": 1,
  "id": "c6f7491c-c9be-444c-86c0-84b066de522a",
  "type": "App\\Notifications\\GetintouchNotification"
}

In my application console i didnt get any notification. I dont know what happend.

doydoy
  • 4,021
  • 3
  • 20
  • 33
Happy Arif
  • 95
  • 2
  • 7

0 Answers0