nuxt-community / laravel-echo-module

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

Can't get event to fire #17

Open goranculibrk opened 4 years ago

goranculibrk commented 4 years ago

Hi there, I'm using 1.1.0 version of the module.

I went through the config and got it all as per instructions, but it seems that this.$echo is not listening for the events.

I can see the messages being received in Dev Tools but the listen code is not responding to them. image

Basic example from the documentation:

mounted () { this.$echo.channel('orders') .listen('OrderShipped', (e) => { console.log(e.order.name) }) }, Does not logs the error. I've tried different changing it to just console.log(e) to see if I'll get any data but it doesn't provide anything.

What am I missing here?

ricardogobbosouza commented 4 years ago

Hi @goranculibrk Could you provide a repository for reproduction?

hostovichqubeek commented 4 years ago

Hello, @goranculibrk, @ricardogobbosouza.

It seems that issues in chained methods. You can't subscribe by using .listen() only by .on().

Working example (pkg version 1.1.0 and laravel-echo 1.6.0)

this.$echo.channel('ch').on('ev', (e) => {
    console.log(e);
});
chapdel commented 3 years ago

@hostovichqubeek your solution did not work for me.

chapdel commented 3 years ago

Issue solved on #9