Skip to content
Advertisement

Broadcasting, laravel-echo-server not receiving events

I’m using Laravel in a project and I want to use broadcasting with laravel-echo-server and Redis. I have set up both in a docker container. Output below:

Redis

JavaScript

A few warnings but nothing breaking.

laravel-echo-server

JavaScript

The client seems to join the channel without any problems. However, if I kick of an event laravel-echo-server doesn’t receive the event.

I did a bit of research and found something about a queue worker. So I decided to run that (php artisan queue:work) and see if that did anything. According to the docs it should run only the first task in the queue and then exit (as opposed to queue:listen). And sure enough it began processing the event I kicked of earlier. But it didn’t stop and kept going until I killed it:

JavaScript

The following output showed in the redis container:

JavaScript

Now I either did so many api calls that the queue is so massive, or something is going wrong. Additionally, laravel-echo-server didn’t show any output after the jobs were ‘processed’.

I have created a hook in my Model which kicks of the event:

JavaScript

Then this is the event it kicks off:

JavaScript

And finally, this is the code on the front-end that’s listening for the event:

JavaScript

.env file:

JavaScript

Why isn’t the event passed to laravel-echo-server? Anything I’m missing or forgetting?

Advertisement

Answer

Started working out of the blue.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement