Setuse setInterval X Websockets

Asked

Viewed 167 times

3

I am developing a PHP application with Angularjs, in this application has a messaging system. I just need to check the message quantity at least every two minutes. My doubt would be, the use of setInterval would be recommended in this case, or the creation of a Socket would be better ? Since the update is just show the user the amount of unread messages and this every 2 min.

  • There has been a similar discussion, see: http://answall.com/questions/10496/an%C3%A1lise-sobre-c%C3%B3digo-ajax/10507#10507

  • Guilherme, in this application, is there no other type of information that has to be synchronized with the client part? Message title or other necessary data?

1 answer

0

In your case I recommend setInterval, knowing that the interval of updates is fixed, Socket will keep an open connection on your server, updating at all times, so I do not see the need for its use!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.