R
R
rusline2017-05-13 14:15:50
Yii
rusline, 2017-05-13 14:15:50

How to implement automatic update?

I need to implement automatic page refresh. Let's allow notification through sockets and automatic updating of data in grid tables. If new orders arrived, then without refreshing the page, new orders appeared.
I have some suggestions to learn sockets or you can learn node js and socket.io. Or maybe there is such an approach with angular.
That is, what will be easier to implement in a finished project. srm project

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Serezha, 2017-05-13
@rusline

If you need to urgently introduce functionality, you can knock on the api every 5 seconds in a loop and return whether there are updates, if so, load the updated data.
If there is time and desire, then socket.io, the mentioned angular here is only for rendering the results, express is enough.
Although first you need to indicate what you have there on the finished project, maybe some js framework has already been pulled up.

M
Maxim Timofeev, 2017-05-13
@webinar

That is, what will be easier to implement in a finished project

It's easier pjax with a certain delay. If this is for the admin panel, then the server will not load too much. socket - of course more interesting, but much more complicated. If only to update the order data in the admin panel - pjax (ajax) - that's it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question