Improvement in Chat application

Asked

Viewed 56 times

2

I am developing a chat for my site where a user sends an invitation to the other user, if the same accepted will be open and the system will be checking new messages.

For the system to do this check I use a while, and while no result returns, I take the last id from the memory I received, I create a query to bring results greater than that id provided. After performing a repeat and returning nothing I give a sleep of 1 second in the not to overload.

I wonder if anyone could build a chat with a different system and how did? Is there any technique that is more performative than the long-time?

1 answer

3


  • Yes, but there is a time limit of 10 seconds, while it is shorter than this time it will be giving the while, in case there are none resulting up to 10 seconds, I finish the while and return 0 for javascript. And then javascript sends one more Ajaxe everything starts again.

  • In this case using websocket can be dangerous, because if the user’s browser does not support HTML5 the system is unusable.

  • I was analyzing it is very good, but the only problem is the browsers without HTML5 support, otherwise it would be perfect. I will give another study on this, because I did not understand much the process. I had never heard of this process.

Browser other questions tagged

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