D
D
Dmitry2016-10-20 01:49:44
Node.js
Dmitry, 2016-10-20 01:49:44

Why is the event not being broadcast through Laravel Events?

There is a bunch of Laravel 5.1 + Socket IO + Redis + Laravel Events .
At some point (I can’t say for sure, because I didn’t notice it myself), the server from the backend stopped sending events to the socket.
That is, previously it was enough to implement ShouldBroadcast and return the required channel in broadcastOn() so that a message gets to Redis and from there to the socket.
Now everything has stopped working and the reason is not clear, but the following option, which is an exact copy of the functionality provided by Events with broadcast, works as it should:

Redis::publish('channel'.$this->room_id, json_encode([
            'data' => [
                'data' => $data, 
                'type' => $type, 
                'room_id' => $room_id, 
                'user_id' => $user_id, 
                'system' => $system,
            ],
            'event' => $event
        ]));

That is, at the output I get what I needed, I didn’t even have to rewrite anything in the nodejs server, but this is a temporary solution and I would like to know the reason for such inadequate behavior of the framework.
For your information - nothing has changed on the server, except for installing either ffmpeg, even the vendor was not updated by the composer (that is, the package versions are the same as before, when everything worked).
An example of a StepByStep manual: https://www.danholloran.me/2016/01/30/laravel-and-...
I have a similar code, adjusted for additional functionality that does not change the main logic.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question