Thinking out loud here,
We have done something similar (but totally different ) We have created a process that keeps track of clients opening a particular screen. In our case it was a screen to look at a remote (as in connected over GSM) device. The connection was only made when a user wanted to look at a device. If they closed the screen, we had to close the connection.
To apply the same system to what you want:
- user loges in
- a script runs querying a table in the db to see how many clients are running on this box (tag ‘[system]client/Network/IPAddress’)
- if zero set screen index to 1
3a. if one set screen index to 2
- store ipaddress and screen index
We also created a watchdog on the server that would clear out old entries if the user didn’t logout cleanly. (think alt-f4 or reboot)
Hope this helps.