3

I'm using Laravel Echo Server with Socket.io. Also I want to use Laravel Notifications for the Real Time Notifications.

Below is my bootstrap.js

import Echo from 'laravel-echo'

window.io = require('socket.io-client');

window.Echo = new Echo({
    broadcaster: 'socket.io',
    host: window.location.hostname + ':7878'
});

Below is my routes/channels.php

Broadcast::channel('App.Domain.User.User.{id}', function ($user, $id) {
    return true;
});

And following is the code in my blade file:

<script>
        Echo.private('App.Domain.User.User.' + '{{ auth()->user()->id }}')
            .notification((notification) => {
                console.log('yes');
                console.log(notification.type);
                $.notify('success', {type: 'success'});
            });
    </script>

But I'm getting the following error: enter image description here

What could be the reason?

Thanks to all in advance.

Siddharth
  • 1,649
  • 4
  • 22
  • 47

0 Answers0