Answer the question
In order to leave comments, you need to log in
How do you make Real-Time applications with Laravel?
I specifically need to make sure that records from the database are published in the news feed in real time without refreshing the page.
This is necessary because this feed will be displayed on a large screen, and no one will update it, as it were (also on phones and PCs).
I will now follow this path:
1) Events
2) Event broadcasting
3) Learning and using Pusher
Is this correct? Maybe there is an easier way for this purpose?
Answer the question
In order to leave comments, you need to log in
Is it correct?Yes.
Maybe there is an easier way for this purpose?Someone and ajax - real-time. If you are one of these "someone", then yes, there is.
Google Server Side events(SSE).
They are lighter than websockets and made for just that. (websockets are two-way channel, SSE is one-way.)
Depends on what kind of data and how much real-time in the project. If everything in the project is real-time, then I would advise you to look at firebase or self-hosted analogues (if you find it) - it will be easier.
If something is simpler, then yes, in this case sockets.
But there is also long-polling.
It's impossible. Do you understand what realtime is? Even if your OS is not realtime, how do you imagine a webserver with realtime?
If you just want to display some information that is recorded in the database, then you need to indicate how critical time is here. That is, "realtime" for you is immediately - within ~ 1-5 seconds or within a minute.
Then it will be possible to know whether something else is suitable to simplify the task, or just push notifications and web sockets.
Easier - nowhere:
1. IFRAME + META REFRESH
2. setInterval/setTimeout + fetch
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question