From the nodes in the left navigation bar, drag and drop the datastream out node.
Double-click on the datastream out node and click on the edit button for the server
Here we will add the Device API Key information that will be used to publish data into our table.
If you have previously configured any nodes with your Device API KEY username and password, your nodes should already be configured.
Next, we will click the refresh button in the Topic row and select our Data Stream and hit Done.
Publish a message to the cloud
Any message payloads sent to the data streams out node will be published to the cloud through our data stream. You can connect any sensor that is receiving data into the data streams out node and click Deploy.
For the purpose of simplicity, we will use an inject node and trigger it to publish a datapoint when it is clicked. Drag and drop an inject node to and connect it the data streams out.
Double-click on the inject node and configure it to publish a value of 10 with a 5 seconds intervals and click Done.
Click Deploy to deploy your code. Now, the inject node generates a message with msg.payload = 10 every 5 seconds and the data stream out node publishes the data to the cloud through our data stream. You can see real-time data coming shown in the console.
Subscribe to the Data Stream
You can subscribe to your data streams and receive the messages published by other apps/clients in real-time. For the purpose of demonstration only, we can subscribe to the Temperature data stream and verify that we can get the same data.
Drag and drop a datastream in node, double click on it, and select the Temperature data stream in the Topic list.
Connect the output of the datastream in node to a debug node and hit Deploy.
You should see that we receive a message with the payload of "10" from the cloud every 5 seconds.
Congratulations! You have successfully published and subscribed to secured real-time data streams over the internet.