Z
Z
zozyla2019-06-25 10:31:51
Laravel
zozyla, 2019-06-25 10:31:51

How to correctly load data without reloading the page in Laravel?

I mastered the basics of Laravel, but now the question arose, what to use in Laravel for constant data loading? For example instant notifications/messages to users. For all the time, there has never been a task to load data without reloading the page, but you need to know for yourself. Ajax setInterval- in my opinion, the most stupid decision in such matters, if our site is completely tied to this uploaded data. The service is described in the docks pusheror something like that, but this is also a very crazy service with horse prices for air. Node.js socketserver? The only option that looks adequate without constant Ajax-a requests. What is the correct way to do this in Laravel?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
hOtRush, 2019-06-25
@hOtRush

https://github.com/centrifugal/centrifugo so as not to climb into the Nodges swamp

S
Sergey Popov, 2019-06-25
@be_a_dancer

The pusher does not have such horse prices, in fact. But as always, you have at least several paths. The first one is polling . You can use it, but it is not suitable for realtime. The second option is long polling and its variation - websockets. Here it is more interesting. Echo server for laravel exists . If you wish, you can raise your own socket-io server and give it data through built-in mechanisms (read the documentation).

M
msk-develop, 2019-06-26
@msk-develop

Local equivalent of Pusher with Laravel Echo support. Written in PHP
https://docs.beyondco.de/laravel-websockets/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question