creativa77/tork_moveit_web_frontend — pull request #13 by basicNew (2014-12-12 19:31:07+00:00)
Title: Session management

Session management is complicated because we need to catch the case the the user has closed the browser/tab but not logged out. If we fail to do so we may keep an EC2 node alive when nobody is using it.
The basic idea is:
- When a user goes to the simulation page, we try to allocate a new node. If we have one available, we associate it with the user. Otherwise we show a "retry later" message.
- At a given interval we "ping" from the simulation page to the server, so we know the user is still there. As a result the associated simulation node is "touched" to register a change timestamp.
- When the user logs out, we release the EC2 node.
- At certain intervals we run a garbage collector that checks for idle simulation nodes. If a node has been idle more than a configured time we destroy it and release the EC2 node.

A different approach that we may want to implement in the future is for the EC2 node to tell the server when the user has disconnected from the web socke, thus removing the ping+GC process. This would require to dig into the rwt server code, which we want to keep decoupled as much as possible.

cc @adamantivm @manzato