Use messages to send commands, status updates, or data, such as JSON, between systems and applications. Messages operate as a network queue, which uses the publish/subscribe model.
This example uses the LabVIEW NXG Message and Configuration APIs. You can use the same code in LabVIEW to send messages between systems.
Customize the gray sections for your unique programming goals.
![]() |
Open Configuration initiates a connection with a SystemLink Server or SystemLink Cloud. |
![]() |
Open creates a message session with the server, which allows you to subscribe to a message queue. |
![]() |
Subscribe registers an endpoint, such as a web application, to a specific topic. |
![]() |
Read returns a message from the queue.
If there are no queued messages, the call
synchronously blocks up to the timeout specified or to
the maximum timeout defined by the web server, whichever
is smaller. If you leave the timeout milliseconds input
unwired, the Read node has a
default timeout of 100 milliseconds. In this example,
the timeout is set to 2000 milliseconds.
![]()
Note
Both NI Web Server and SystemLink Cloud have a maximum timeout of 10 seconds. You can edit the timeout for the NI Web Server, but you cannot adjust SystemLink Cloud's timeout. To adjust the timeout for NI Web Server, edit the configuration file of the server. Refer to Configuring NI Web Server more information. Use Unflatten from JSON when using Read to make messages easier to parse from a web browser. Use a While Loop to continue reading messages until a condition is met. In this example, the node reads messages until there is an error. |
Customize the gray sections for your unique programming goals.