1
I need to enable message notifications on a web page,
Example,
User receives a message and I notify him that he has a new message but without updating the page.
How can I make a function that runs every two or three seconds an ajax to check if there is a new message available?
If you want ajax use ajax Polling method, using the
setInterval
, the ideal however would be to use the Websockets, it is much more economical and performatic, however it is more complex and the PHP doesn’t handle it so well, but you can outsource this using Pubnub, Pusher, Ably.io, Scaledrone, Hydna, Google Drive Real Time...– Inkeliz
Related: http://answall.com/questions/9475/notifications-tempo-real-simillate-ao-stack-overflow/10109
– Inkeliz
@Inkeliz thanks, I needed something really simple and your answer answers my question well.
– rafaelvaloto
websockets is a much better technology for this, but is only compatible with the most current browsers.
– Washington da costa