Answer the question
In order to leave comments, you need to log in
How to properly organize deamon in an angular application?
Hello, there is a task to write a message module in the project. As a backend - php (yii2), and on the frontend parts of angular (dynamic pages). In messages, you need to check for new messages approximately every 20-30 seconds. What is the best way to organize this daemon in angular? Thank you.
Answer the question
In order to leave comments, you need to log in
You make a service, shove $http.get inside, as soon as get is completed, after a timeout you start the next one.
When processing data from get, you throw out a notification of new messages through the scope. The task is the most trivial.
long polling is the best solution if you don't want to use sockets.
I did a similar task, but only with ZF2. It is not difficult to implement.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question