Main Content

Troubleshoot MQTT Subscribe

The MQTT protocol provides minimal feedback and error messages are limited. Use these steps to troubleshoot a connection and subscribe to a channel or channel field. The steps all independent possibilities, but they are listed with the most likely problems listed first.

  1. Ensure that your MQTT API Key is correct. This value is different from your user API Key, the channel Read API Key and the Write API Key. The MQTT API Key is found on your profile page. Select Account > My Profile.

  2. The MQTT API Key is required at connection when subscribing to both public and private channels.

  3. Ensure that the client address is If you incorrectly configure your client to connect to the ThingSpeak™ MQTT broker, your connection request is rejected.

  4. If a connection is successful, the server responds with the last value in the subscribed channel. If you receive no response upon subscription, check that there is data in your channel and that the user name used in the connection is not blank.

  5. Check that you have the correct topic format for Subscribe to a Channel Feed, or Subscribe to a Channel Field Feed.

  6. Check that you have the correct topic API Key. To subscribe to private channels, your topic must contain the Read API key.

  7. Make sure your QoS is set to 0. Some devices have a default QoS that is different than 0. Some clients require you manually change the setting. Some of the MQTT API examples show how to subscribe with QoS 0.

  8. CleanSession must be set to 1 if it is specified.

  9. Make sure that the port is correct. See MQTT Client Configuration for a list of accepted ports.

  10. If you are having trouble connecting with SSL, be aware that your client may require extra steps to enable a secure connection.

See Also

Related Topics