T
T
tushev2020-08-20 21:33:58
Laravel
tushev, 2020-08-20 21:33:58

How to achieve speed in Laravel broadcasting?

I am writing an application on Laravel in which it is necessary to deliver information to users asynchronously (several dozen users at the same time and about one message every few seconds).

I made a connection with the Pusher service as suggested in the official documentation. However, messages are delivered with a delay of about 1 second, which is too long for my purposes. As far as I understand, the delay occurs mainly during the connection between Laravel and Pusher.

Additionally, the Laravel documentation offers two more options for installing the server on your own.
1. laravel-websockets - The laravel-websockets is a pure PHP, Pusher compatible websocket package for Laravel. (But something scares me to use a websocket server in pure PHP. Or in vain?)
2. Bundle Redis + Socket.IO (Some kind of collective farm at first glance)

I also tried to use the Firbase Realtime Database service to deliver data in real time, but here the data delay is even longer, about 2-3 seconds.

What would you recommend to use for broadcasting. Reliability is very important and delivery speed should be less than 1 second.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2020-08-21
@Sanasol

The problem is not in the pusher / firebase / sockets for sure, there are no such delays under normal conditions.
Check the settings, maybe the config is somehow through the files, and not the radish / pusher / queue is configured or something.
Maybe your internet is like this.
Etc.
Look for the source of the delay.

(several dozens of users at the same time and about one message every few seconds).

you can get by with Ajax, the server will not die from several dozen requests every few seconds.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question