drewbe121212
Feb 7th 2008, 12:00 pm
With the mass use of AJAX lately in web applications, I have come across an interesting thing. I am going to be designing an AJAX based script that will need almost every user on the site to be continually polling at approximately every second to three seconds. However, if this user is not currently active with the page (left there computer for whatever reason, but left the webpage up), I want to keep the AJAX from continually spinning (polling) until they return. When they return the new request and obtain all the information they missed in there absense.
Does anyone know anything good or an article related close to this? I have google'd and found nothing.
What I am thinking is that to be AFK it would mean that there mouse nor keys have been pressed/moved.
I guess a very crude way to do this would be to reset a countdown timer every single time a key is pressed or a mouse is pressed, and if that countdown timer should reach 0 set the user AFK and stop the polling until they return.
Please let me know your thoughts on this, and some ideas you may have for this. The user will be able to type very agressively if needed on this page so I wonder how the constant reseting of a timer would be with constant key typing and mouse pressing, and if it could cause some issues.
A Listener could be another alternative as well...
Please let me know your thoughts / ideas! Because this will be a very interesting beast for me.
Does anyone know anything good or an article related close to this? I have google'd and found nothing.
What I am thinking is that to be AFK it would mean that there mouse nor keys have been pressed/moved.
I guess a very crude way to do this would be to reset a countdown timer every single time a key is pressed or a mouse is pressed, and if that countdown timer should reach 0 set the user AFK and stop the polling until they return.
Please let me know your thoughts on this, and some ideas you may have for this. The user will be able to type very agressively if needed on this page so I wonder how the constant reseting of a timer would be with constant key typing and mouse pressing, and if it could cause some issues.
A Listener could be another alternative as well...
Please let me know your thoughts / ideas! Because this will be a very interesting beast for me.