From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Web Development Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Limiting number of clients/web browsers to 1

Solved!
Go to solution

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

0 Kudos
Message 1 of 3
(2,342 Views)
Solution
Accepted by sbraja

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. 

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
Message 2 of 3
(2,315 Views)
Solution
Accepted by sbraja

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.

0 Kudos
Message 3 of 3
(2,120 Views)