Answer the question
In order to leave comments, you need to log in
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
]));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question