views:

259

answers:

1

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.

+2  A: 

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.

paulgreg
Accepted, mostly because it's the only answer after one year, and it does point to some good resources. There is no other way to allow remote users control over this, other than through their browsers.
Bratch