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.
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.
Download and install MQTT.fx. This example was tested with MQTT.fx version 1.3.1.
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.
In the Connection Profile dialog box, enter the Broker
mqtt.thingspeak.com and Port
1883. Press the Generate button to
generate a unique Client ID.
Choose the User Credentials tab, enter any user name and your MQTT API Key from your ThingSpeak™ Account > My Profile page.
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
/<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.