A
A
AlexSer2018-06-25 16:52:41
Yii
AlexSer, 2018-06-25 16:52:41

How to notify about status changes in Yii2?

Hello everyone, there is a table that stores the state of the status. Well for example on adding of record.
1) 1-Entry added;
2) 2 - Record edited
3) 3 - Record confirmed
and let's say there are 2 user levels
1) root - administrator rights to add, edit and confirm a record
2) user - user - add a record.
We need to organize. if root confirms the entry, a modal window pops up for the user about changes to his added entry.
Just add an ajax script to js that checks the user's posts at intervals? Or are there more cultural solutions?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2018-06-27
@webinar

Dmitry Bogdanov is right, except for point 4. If the project is small and there are not many users, then to fence something from the first 3 points, this is just "from a cannon to sparrows." Ajax is the simplest option and often the surest one. Yes, it is primitive compared to others, but when you need a hammer, you need to take a hammer, and not look for its most technologically advanced fellow.
To determine which one is correct, you can only see t.z.

D
Dmitry, 2018-06-27
@php10

1) Long polling.
2) https://github.com/walkor/Workerman
3) node.js + socket.io
4) Don't use AJAX.
For these purposes, it is better to use web sockets. I used NodeJS and Workerman for this purpose. And both do their job.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question