This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Subscribe to Channel Updates Using Desktop MQTT Client

This example shows how to use a desktop MQTT client such as MQTT.fx, which is a JavaFX based MQTT client, to subscribe to a channel.

  1. Obtain the channel information. For a public channel, you need only the channel ID. Private channels also require the Read API Key. The channel ID is available on the upper left of the main landing page for your channel.

  2. Download and install MQTT.fx. This example was tested with MQTT.fx version 1.3.1.

  3. Configure the connection profile for the desktop MQTT client. Press the gear icon to the right of the profile name, and then the plus button on the lower left.

  4. In the Connection Profile dialog box, enter the Broker Address and Port 1883. Press the Generate button to generate a unique Client ID.

  5. Choose the User Credentials tab, enter any user name and your MQTT API Key from your ThingSpeak™ Account > My Profile page.

  6. Subscribe to the channel. Using the topic formats described on MQTT Basics, enter the channel of interest. For this example, subscribe to theMathWorks® weather station and receive posts in JSON format. For a private channel, add /<Read API Key> to the end of the topic name. Make sure to select QoS 0.

You are now set up to receive messages in the client each time the weather station data is updated.

See Also

| | |

Related Examples

More About

External Websites