M
M
Mark2017-10-18 16:45:09
JavaScript
Mark, 2017-10-18 16:45:09

How to properly organize new action notification in Yii2?

Hello. Suppose we have a certain action, for example, an order.
You need to make a notification if a new order has arrived in the site tab (for example: sound, not the point).
As I see it:
1. Add a column to the database unread, when adding an order, assign it 1.
2. Make actionit, which if there are new orders - returns their number, if not - returns null.
3. Check new orders with jQuery+AJAX using setInterval().
4. If there is a new order - notify. The "Mark as read" button also appears - when it is pressed, all orders with `unread` containing 1 take the value 0.
What are the pitfalls? Perhaps there are better options?
Thanks for answers.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kuznetsov, 2017-10-18
@dima9595

Sockets as an option

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question