User Interfaces with LabVIEW NXG Web Module

Have you tried making user interfaces with the Web Module in LabVIEW NXG? In this post, Poul Lindholm Pedersen, Ph.D. Physics will give you an overview of the options.

One of the great innovations in LabVIEW NXG is the Web Module. Web Module opens the possibility to make websites directly in LabVIEW and makes the transition between VIs and the web much simpler. The key is the new webVIs, where you can transform the front panel to a web page while retaining the functionality of the block diagram.

WebVIs

The advantage of webVIs are that you, as a LabVIEW developer, can easily create a webpage without worrying about HTML, CSS, JavaScript, etc. It is simple to connect a webVI to a normal VI, so you can easily create a more modern user interface that is accessible from everywhere. Contrary to web publishing in previous versions of LabVIEW, webVIs don’t require any downloads to function – all browsers are able to open it.

In many ways, webVIs work as ordinary VIs. The normal controls on the front panel are replaced by widgets but the graphical expression is the same. When the webVI is compiled, the front panel is translated to HTML/CSS, and the block diagram is translated to JavaScript. Since the entire web page consists of HTML and JavaScript, it is easy to modify the code outside of LabVIEW, and you can also add third-party widgets through the built-in JavaScript Library Interface.

In order to make webVIs compatible with mobile devices and tablets, the Web Module makes resizing of the front panel simpler, so the page can be viewed on displays of all sizes. In practice, this is done by grouping the widgets in boxes that dynamically adapt to the size of the screen.

Data Services

Apart from webVIs, there are several data services available in the Web Module, allowing for the web page to connect to e.g. a backend. At present, there are three different APIs available: HTTP, WebSocket, and SystemLink. HTTP is the well-known protocol from the internet, and from a webVI it is possible to access any API that conforms with REST. WebSocket is a continuous TCP connection, and as opposed to the HTTP protocol, it is full duplex, i.e., data can be transmitted in both directions simultaneously. SystemLink is NI’s service for integrating and managing distributed systems.

HTTP is a good all-round choice since it allows high flexibility and is also very common. WebSocket lends itself to streaming and low-latency communication but can be more difficult to implement on the server side since no solution exist that implements security. SystemLink is well-suited to communicate between LabVIEW applications or to an NI Web Server.

NI Web Server

NI Web Server is also a part of the Web Module and can be used for setting up a server to host a webVI. One of the most important features is the built-in security configuration allowing for secure access to your user interface. As an alternative to NI Web Server, it is also possible to host a webVI through SystemLink Cloud, so you avoid maintaining a server yourself.

Read more about webVIs

Share:

LinkedIn
Facebook
Email
#blog

Previous Posts