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.

Troubleshoot MQTT Publish

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

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

  2. Check that you have the correct topic format to Publish to a Channel Feed or to Publish to a Channel Field Feed.

  3. Check that you have the correct topic API Key. For MQTT publish, your topic must contain the Write API Key.

  4. 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.

  5. Do not set CleanSession flag to 0. If you set the CleanSession flag to 0 on your MQTT client, any connection request to the ThingSpeak™ MQTT broker is rejected with a CONNACK status of "0x05 Connection Refused, not authorized".

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

  7. Do not set the Will flag to nonzero values on your MQTT client. Any connection request to the ThingSpeak MQTT broker with nonzero Will flag is rejected with a CONNACK status of "0x05 Connection Refused, not authorized".

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

See Also

Related Topics