Subscribe to Channel Updates Using Desktop MQTT Client
This example shows how to use the MQTT.fx desktop client to subscribe to a channel. MQTT.fx is a JavaFX based MQTT client. This example uses the ThingSpeak MQTT legacy interface.
Set Up Software
1) Obtain the channel information. For a public channel, you need only the channel ID. For a private channel, you additionally need the read API key. The channel ID is available at 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.
Configure MQTT Connection
Configure the connection profile for the desktop MQTT client.
1) Click the gear icon to the right of the profile name, and then click the plus button on the lower left.
2) In the Connection Profile dialog box, enter the
mqtt.thingspeak.com for Broker Address and
for Port. Click the Generate button to generate a unique client ID.
3) On the User Credentials tab, enter any user name and your MQTT API key from your ThingSpeak™ Account > MyProfile page.
4) Subscribe to the channel. Using the topic formats described in MQTT Basics, enter the channel of interest. For this example, subscribe to the MathWorks® 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.
- Use Particle Photon Client to Subscribe to Channel Updates
- Publish and Subscribe to a Channel Using Desktop MQTT Client
- Publish and Subscribe to a ThingSpeak Channel Using Secure MQTT
- Publish Using WebSockets in Python on a Raspberry Pi