Jump to content

I am on that webpage - Project

Recommended Posts


Thank you for your help with this specific project and its been ongoing for a while now. I been doing alot of consulting of where I should start  I will do my best to explain this....

Lets say your in a office with 2 groups of 10 people.  Those 10 people jump on the same websites everyday. The problem is no 2 people should be on the same website if one is working on it.

a notification should pop up at some point and say "user ID X is currently working on this page please wait..."  or something relevant to that.  Once that person is done working on that webpage then

the person making attempts can finally access it. Below is a statement from another consultant



"The AJAX part is the way I would communicate with the node backend. From the multi-view, I would make an AJAX call every few seconds passing in the robot id and user id. You would then mark that robot as in use by that user. When you have not heard from me in some amount of time, you would mark the robot as not in use.  When I first load a robot control web UI, I would make a different AJAX call with the robot id to see if it is already in use by someone else. If it is, I would keep asking every few seconds in case the other user leaves that robot while I am still looking at it.

so you would just need a couple of APIs and the logic that keeps up with who is viewing which robot. At the simplest level you could do all this in memory with no CSV or database."


Basically, we work with robots and the control panel is through the web interface we use. Each robot has an ID as well as the people working on them also have ID's which is usually there email.  I would prefer however to do this in a CSV or DB  The problem is we do not want 2 people working on the same robot at the sametime.  Today there is nothing that notifies us if someone else is working on that robot or not.  You will see in the statement he mentions "Multi-View" which is a custom UI that uses tampermonkey chrome plugin to overlay a better interface over the actual interface. I hope this description is not to vague, if it is please let me know and I will try to go way more indepth of what is needed for this project.

Share this post

Link to post
Share on other sites

How would I be able to build something that tells someone else they are on that specific URL? I am working to collect more data for better understanding of the issue... please be patient.

Share this post

Link to post
Share on other sites

This is my take on your question.
Have a sign in page. This will give the user an identification. On that page list all things that are to be worked on. Identify which items are in use and which are open. Maybe back ground color etc.. The user selects what he/she wants to work on first - that assigns this page to her. Then have user pick which he wants to be notified when available. Add him to the list.

You can work thing out from there.

  • Like 1

Share this post

Link to post
Share on other sites

There are many different ways to handle this.  Personally I would probably use Redis hashes for this, or a mongoDb collection, but if you don't have those options, then one of the simplest and cleanest options is to use SQLLite3.  There is full support for Sqllite via a node library, and it has essentially no footprint other than the underlying c libraries.  Tables can be persisted to the filesystem or used in memory.  I see no reason not to persist them to a file.

You would need a simple table keyed by robot name with the following fields:

  • robot (text)
  • user (text)
  • from (integer)
  • to (integer)

The from and to columns would be timestamp values.

Personally, it would be nicer to use websockets rather than polling, but either way, the client code will query the db for a particular robot where the current timestamp > from and < to.  If any rows come back then, you check if the user is the current user.  If not, then display to the user that "user x currently has this robot".  The entire table could also be queried to show which robots are currently assigned to which users.  

If a user wants to assign themselves an available robot, then then simply insert a new row with the current time as from, and some reasonable future time that syncs with your client "checkin" ajax code.  5 or 10 minutes might be a good starting point.   The "checkin" code would query current user's robot row, and update the from, extending it by 5 or 10 minutes at each checkin.  The advantage of this is that any allocations will expire if the user doesn't release the robot properly or their page dies.

Sqllite will handle concurrency and locking for you via transaction support (you wrap your select and insert/update activity in a transaction).

To release an allocation, you'll just need a routine that deletes the row for that robot.  You might also want another table for the robots themselves, and even use a standard relational 1-M model with an id for key, but that is up to you.  Somehow the code needs to know the fulll list of available robots, and you might as well use sqllite for both problems.

Just to keep the database pruned and small, I'd suggest writing a small program that runs from cron, and cleans up any expired robot allocation rows ( current timestamp > to).  You could run this in whatever iteration you would like.  There might be some value in having a historic record of robot allocations, so cleaning out old rows removes that, whenever you actually run the pruning.  

  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.