laravel-echo-module icon indicating copy to clipboard operation
laravel-echo-module copied to clipboard

Can't get event to fire

Open goranculibrk opened this issue 4 years ago • 4 comments

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?

goranculibrk avatar May 16 '20 11:05 goranculibrk

Hi @goranculibrk Could you provide a repository for reproduction?

ricardogobbosouza avatar May 19 '20 21:05 ricardogobbosouza

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);
});

hostovichqubeek avatar Jun 02 '20 12:06 hostovichqubeek

@hostovichqubeek your solution did not work for me.

chapdel avatar May 20 '21 14:05 chapdel

Issue solved on #9

chapdel avatar May 20 '21 15:05 chapdel