I am trying to make a web chat application which interacts with gtalk. was successful in sending messages to the gtalk user from my app. I am able to receive the message on to my server also if the gtalk user pings me from the other end, but the problem is how do I know that there is a message waiting. I could only think of an ajax hit every 5 secs or something. Is there a better way to implement it?
Thanks for your time.
According to your question, I think you’re searching something like a push mail system, that is, you are trying to get a push from server to browser. But,I don’t think there is any better way than an ajax hit every 5 seconds.
There is a way with Comet, it doesn’t do the trick so well. See here
But, in HTML5 you have socket. you can get more about socket from following links:
http://en.wikipedia.org/wiki/WebSocket
https://stackoverflow.com/questions/4262543/what-are-good-resources-for-learning-html-5-websockets
So considering all aspects, it will be better to go with your choice.