Bratch
Bratch

Reputation: 4223

How to Queue Users in a Web Application?

I have a robot that is contolled with a local UI via a 9 pin serial connection and I would like to make it controllable via a web page, but only one user should be able to interact with it at any time. I'm still thinking about how to use WCF communications between the web server and the local PC, and might ask about that at a later time. For now I'm tying to get the web server and front end to queue users who want to control the robot, first come, first serve.

The only thing I have thought about so far is to store user sessions in the order they request to control the robot, and then use AJAX to let each one know when it's their turn. I want to show the user where their place is in the queue and move users forward in the queue when others are done, abandon their sessions, or timeout during their turns.

Does this seem like the right idea? Have you already done this and have a good method that works? I'm open to hearing about how it was done on any platform as long as the concepts also apply to doing it with ASP.NET.

Upvotes: 2

Views: 1693

Answers (2)

Jazz
Jazz

Reputation: 1

There is one solution in fact which is .NET remoting.

The definition is true as a token, or let's say an object should be passed.

Upvotes: 0

paulgreg
paulgreg

Reputation: 18933

In my opinion, web applications are made to be multi-users and massively concurrent. So, I'm not sure a web application is the best answer to your problem.

However, I think it's possible to manage that problem on a webapp by managing an unique token shared between multiple clients (like on a token ring network).

On the client side, like a chat system, you'll have to keep client's connections open. To achieve that, I think you'll have to implement the Periodic Refresh Ajax pattern.

Check also "content pushed by the server" systems, like Comet for example (I know it was Java only some times ago but I'm pretty sure an .net equivalent is available).

Here's a rapid description :

In web development, Comet is a neologism to describe a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it

Here's also an interesting article about Comet on Ajaxian.

Upvotes: 3

Related Questions