B
B
boozzd2015-07-27 11:38:06
JavaScript
boozzd, 2015-07-27 11:38:06

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

3 answer(s)
_
_ _, 2015-07-27
@boozzd

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.

V
Valentin Dubrovsky, 2015-07-27
@matroskin13

sockets

S
Sergey Pashkevich, 2015-07-30
@siarheipashkevich

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 question

Ask a Question

731 491 924 answers to any question