Skip to main content
Version: Next

FAQ / Troubleshooting

Connection issues

MQTT won't connect to external broker

Usually this problem arises from an improperly configured network.

  • Make sure, the external broker is available from the network you're running a smoothMQTT app in.
  • Your smoothMQTT app needs to have one MQTTManager prefab instance in the scene.
  • Confirm the IP address and Port on the settings component match the address and port of your broker.
  • Check if the broker's firewall accepts incoming connections on the MQTT port(s)
  • If it still doesn't work, restart the broker and restart the unity app.
  • NOTE: If you have a very slow network connection, you might want to increase connection timeout (on settings component) to above 3, however if this is necessary your MQTT experience will be far from realtime.

I can connect but neither send nor receive messages

Check if the broker has user management and restrictions in place. Use proper username and password in settings component.

I can connect and either send or receive messages, but not both

There are user restrictions in place in the broker configuration. Make sure the client user has access to all topics to be used.

Leading Slash in Topics

This is a syntactical problem typically encountered in MQTT. The topic /test/topic and test/topic are not the same. While both are valid, some other client not from your unity app (for example a sensor or a python script) might use URL-notation for MQTT where the second slash might be autoremoved, i.e. mqtt://user:password@hostname//test/topic does write to test/topic instead of /test/topic. This is very hard to find and debug, so my suggestion is to never use a leading slash in your topics.

Tools Menu does not do anything

Check your console for any warnings. If it says "No Gameobject selected" you need to select a gameobject in your scene or hierarchy before trying to add the components.

Android Builds

  1. Make sure that the Android platform is activated in Assets/smoothMQTT/Scripts/SmoothMQTT/SmoothMQTT.asmdef. By default, it is deactivated, because it is not an officially supported platform. (Alternatively you can click on Tools/SmoothMQTT/Activate Android. It will try to switch to Android and change the asmdef file for you.)

  2. Confirm that the API Level is set to 29 or higher. Although it may work with lower levels, there are no guarantees.

  3. Install a debug build (while building check "development build" and "script debugging") on your phone and check the logcat output after starting the app. To do this, you will need to enable USB debugging and use a tool such as Android Studio to read the logcat logs. Filter the logs by your app name as defined in the Player Settings.