Users wait in line

Results 1 to 2 of 2

Thread: Users wait in line

  1. #1
    Brett Springall Guest

    Default Users wait in line

    I have a web cam with pan/tilt/zoom controls. I want to make a page where users wait in line for control of the camera. It is easy to give a user control, and make a time out on the page. But the difficult part is passing control to the second person in line when the first user leaves or is timed out.<BR><BR>Does anyone have any ideas on how to acheive this, any help greatly appreciated.

  2. #2
    Join Date
    Dec 1969

    Default RE: Users wait in line

    Not real hard to do.<BR><BR>(1) Use an Array to keep a list of people in line. Could make it a dynamic array or could just give it a fixed size (so never more than "N" users in line).<BR><BR>(2) Put the array into an Application variable.<BR><BR>(3) In the browser, use a "hidden" frame and have it auto-refresh itself every so many seconds (15 seconds?). It is an ASP page that simply checks to see if the current user (by Session.SessionID? easy to use, guaranteed unique?) matches element zero of the array (has reached the top of the list). <BR><BR>(4.a) If so, then this user gets control. Return a page that uses JS to post the "you are in control" info to the visible frame in the browser.<BR><BR>(4.b) If not, simply send back the same page that waits the same 15 seconds.<BR><BR>(5) To protect against somebody simply giving up and leaving your site, have the ASP page of step 3 *also* check how long it has been since the current top-user was selected. If longer than about three times the interval has passed (45 seconds, if the browser refresh is set at 15 seconds?), then toss away the current top-user and move everybody up by one before doing the check.<BR><BR>(6) If the user is not *in* the list, you might assume that they left your site and then came back. You could give them a "sorry, you lost your place message" or simply put them back in line. Your choice.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts