nuxt-community / laravel-echo-module

Laravel Echo for Nuxt 2
MIT License
86 stars 31 forks source link

Not receiving any data from echo #35

Open sts-ryan-holton opened 3 years ago

sts-ryan-holton commented 3 years ago

Hi, I'm having trouble getting any data to come through with this package and wonder whether it's working as intended. I've got Laravel Websockets set up (the package) and have my websocket server running and can see in the console that it is receiving data, but I'm not seeing any data coming through my channel to my Nuxt JS project.

/*
** Echo config
*/
echo: {
  broadcaster: 'pusher',
  key: 'websocketkey',
  host: 'http://localhost:6001',
  plugins: [ '~/plugins/echo.js' ],
},

In my web page, I've got:

this.$echo.channel('agents')
        .listen('AgentStats', (e) => {
            console.log(e);
        });
    }

My event channel is called agents, it's on a private channel, and the event is called AgentStats, but I see no data logged in my console log.

melvin78 commented 3 years ago

did you manage to solve it?

4KDA commented 3 years ago

did you manage to solve it?

Use .on instead of .listen

melvin78 commented 3 years ago

ok thanks. I can see your echo configuration file in nuxt is a little bit different . I that everything?. Or there is no difference between host and wsHost?