Sheffield LabVIEW User Group

Showing results for 
Search instead for 
Did you mean: 

WebSockets: Bringing LabVIEW to the Web

Hi All,

Nice to see some of you again and some of you for the first time.

I hope you found my presentation interesting and that it's shown you some of what you can do with interfacing with your LabVIEW application from a web browser using WebSockets.

Just to follow up on my presentation, I've attached a PDF copy of it and the code I demo'd to this post (LV2013).

You'll need to install the two included VI packages (one for my QSM helper library and the WebSockets API) to open it and you'll also need to deploy/run the web service (and update the constants in the main VI).

Feel free to ask any questions either here or by email (

Hopefully see you all next time where someone else will be presenting!


Message 1 of 25

Hi Sam

Thank you for a very inspiring presentation at the CLAe summit.

This is a great example but I am having trouble running it. Can you give some more detailed advise of what to change (IPs, port etc) to make it run on an existing wireless network?

And please also some explanation on the web addres to use on the client browser.


H. Molsen, CIM Industrial Systems
Message 2 of 25

Hi Henrik,

For my demo, I configured the NI Application Web Server to run on port 80 which means that you don't need to include the port number in the URL. If your NI Application Web Server is running on a different port then you'll need to include that in the URL. When you deploy/run the Web Service, you should be able to view the URL to the items from the right-click menu.

If you change the WebSocket port (default is set to 7890), you'll also need to update it in the javascript file.

You may also have other networking issues to contend with - e.g. firewall

Message 3 of 25

Hi Sam,

when i try to run the demo, it says that "SubVI" is missing

any advice,


0 Kudos
Message 4 of 25

You need to install the VI Packages included in the .zip file to install the pre-requisite libraries.

Message 5 of 25

thanks very much, i got no more errors now. i am very new to websockets, any advice from where to start. Because i need to control and view the labview front panel remotely over the internet.

As i am working now on my final project, which is to measure the liquid level in tank and send data wirelessly to Labview using xbee, then i need to provide means of remote monitroing and controllring for the tank level.

Thanks again

0 Kudos
Message 6 of 25

Sam, this is awesome! Thanks for sharing. I am adapting your chat demo for my own application. I'm a LabVIEW nooby. A quick question for you. When I make a change to the Connection Handler, how do I get LabVIEW to recompile it and load it into memory on my device? At the moment, the only way I've found that works is to close the project and reopen it. Again, thanks heaps for sharing. This is fantastic.

0 Kudos
Message 7 of 25

What device are you using? LabVIEW compiles automatically in the background so you can just 'run' it and it will use the updated VI. If you're running it as an executable or on an RT target, you just need to re-build the build specification.

0 Kudos
Message 8 of 25

Hi Sam,

Thanks very much for your reply. I'm using a CompactRIO controller. I was just running the top-level VI directly. I have since built a build specification and now it seems to be picking up changes I make to the Connection Handler. Forgive my stupid questions, but I've been struggling to get the debug tools with these VMs. I guess it's because it is launched with an asynchronous calls. Do you have any tips for debugging or do you know of a trick to get the debug tools running?



0 Kudos
Message 9 of 25

If you're running in the development environment then you can change the connection handler to 'open front panel when called' from the VI properties and it will show it's front panel when the handler is launched or put a breakpoint in the connection handler and it will show the block diagram and pause execution when it hits the breakpoint.

0 Kudos
Message 10 of 25