Event not working with Laravel Websockets

Viewed 25

I need to implement the socket in the Laravel project which has been upgraded from 6.0 to 8.0.

here is the code of bootstrap.php

import Echo from "laravel-echo"

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: 'anyKey',
    wsHost: window.location.hostname,
    wsPort: 6001,
    forceTLS: false,
    disableStats: true,
});


window.Echo.channel('DemoChannel')
    .listen('webSocketDemoEvent', (e) => {
        alert('socket here');
    })

Can someone please suggest what the issue in

0 Answers
Related