08-14-2020 10:52 PM
Dear LabVIEW Web development Experts,
I need your help. I have a LabVIEW embedded application running in sbRIO and a web based user interface (via LabVIEW Web Services) running in a windows PC. The browser is google chrome. Now, I would like to limit the number of browsers that can connect to the sbRIO application to 1, so that the browsers won't fight each other while sending commands. So, just one PC and within that PC, just one browser tab.
There is an article (below) that talks about how to increase the number of clients. I tried follow the same for reducing the number of clients, but it doesn't seem to work.
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019OlXSAU&l=en-US
Can you please help by sharing any ideas that you may have?
Thank you,
Raj
Solved! Go to Solution.
08-15-2020 03:26 AM
Hi Raj,
This isn't trivial as http connections are very short lived and any browser window is actually a series of many connections
I think to do this you need to write the concept of a session into your web service. The first browser starts a session and any others then can't set data until the first ends the session.
I'm not aware of anything built in for this, you would have to write the code yourself. This would involve some sort of session variable which is checked on each request.
It might be easier if you use a websocket for control instead. It may be easier to limit connections with this rather that HTTP.
10-09-2020 10:34 AM
James,
Thank you for the reply. I ended up implementing my own "hand-shaking" in the code such that when a browser is launched, you need to press "Take Control" button and no other browser instances will get control (View only). The idea is, only one browser (or one user) can control the system at a time. I wish there was an easier method. But I got it working now though.
Again, Thanks for the reply.