LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What's an effective way to pass a cluster of data to a web VI

Solved!
Go to solution

I'm trying to build a web app using the NXG web module.  I understand that NXG is being discontinued but the web module will live on and it seems to be a decent investment of my time. If that's a dumb idea, I'd be happy to hear about it. The concept is to have a Labview VI acting as a server accumulating and processing a bunch of data.  Anyone with the right credentials would be able to fire up a web vi in a browser on a remote computer.  The remote client would display the data and allow user interaction e.g, panning and zooming graphs, saving the data locally and so on.  My idea is for the server to do all the processing and package the data in a cluster.  When new data comes in, the server will process it, add it to the cluster and send it out to whatever clients have subscribed.

 

My questions are what Labview functionality is appropriate for this and can someone point me at an example?  Here's the options I'm aware of.

 

1) Websockets

2) HTTP

3) Systemlink

4) TCP

5) UDP

6) Network streams

and probably others

 

Data comes in very slowly, like once every couple of hours. In the short term, the cluster will be less than 1kByte to start and less than 100 kBytes or so max.  So it seems reasonable to just send all the data when required.  In the long run, the cluster will become larger and I'll have to figure out a way to deal with that but for now, I'd just like to get the simple case running.

 

Thanks

0 Kudos
Message 1 of 6
(147 Views)

My recommendation would be to flatten the cluster to JSON and publish it using a SystemLink Message.  Any WebVI that is running and subscribed to the same message topic will receive the data and can then unflatten from JSON back into the cluster.

Message 2 of 6
(91 Views)

JSON is a great idea.  I was aware of Systemlink but didn't really know much about it.  I went through some tutorials and it looks great also.  But I can't  find any Systemlink VIs in the NXG web module.  In the Data Communications menu there's just HTTP, Websockets and queues.  There are a bunch of Systemlink VIs available in my Labview server. Am I missing something. 

0 Kudos
Message 3 of 6
(80 Views)

I would recommend installing the LabVIEW SystemLink Toolkit.  It should include support for LabVIEW 2017-2020 and NXG 5.0.

 

https://www.ni.com/en-us/support/downloads/software-products/download.labview-systemlink-toolkit.htm...

 

Screen Shot 2021-01-14 at 2.41.56 PM.png

Message 4 of 6
(71 Views)
Solution
Accepted by topic author geneM

If the data is being published really slow you could also look at using tags.  They don't support clusters, but again you can flatten the data to a JSON string and store it as a string tag.

 

Here is some more information to help get started.

https://github.com/ni/webvi-examples/tree/master/CallSystemLinkDataServices/

 

Message 5 of 6
(65 Views)

@JoshuaP - I've downloaded the stuff you pointed me at and it looks like an excellent solution for my immediate job and also for some jobs down the road.  I've got lots of reading and experimenting to do but it looks great.

 

Many thanks - Gene

0 Kudos
Message 6 of 6
(57 Views)