PDA

View Full Version : User Queue


enigma12814
01-08-2010, 10:29 PM
Howdy folks, sorry for the bother, but I'm stumped. I am trying to create a User Queue and can't figure out a way to make the user queue update every time someone else is added to the database.

Basically all I need is a page that says "You are user #_ in the queue" that will update every time someone else adds themselves to the queue. The queue is stored in the database. I have it right now with a setInterval that runs every few seconds and ultimately sends an XML HTTP Request to get the current amount of users. Is there anyway to make the page update anytime the database changes (user adds themselves to the queue) as opposed to every few seconds?

It all ends up as users waiting in line to start up an application. Once there are 5 users, they will be redirected. Any help at all is greatly appreciated.

bdl
01-09-2010, 12:21 AM
I see what you're getting at; you want everyone's view to update when any single user adds themselves to the queue. I don't see any solution but to run setInterval() ever N seconds to update the status. It would be nice if you could "push" status to each user from the server-side script, but I can't think of an easy way to implement this.