IoT Fundamentals

Top 3 online tools to simulate an MQTT client

María Hernández
· 3 min read
Send by email

MQTT is an “Internet of Things” connectivity protocol. Designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium (Source: MQTT.org).

MQTT is especially useful to push data to your devices. Imagine a cloud-controlled device to open/close a door remotely. In the case of HTTP, the device would have to continuously make GET requests with the server to see if there’s a change in a variable. Once the GET request is received, the server then has to make an action depending on the last reading form the device. This takes a lot of requests and is inefficient since as it depends on the polling frequency. With MQTT, the device can “listen” to the cloud and only be notified when there’s a change in the variable. This way, the connection between the device and the cloud is left open but data only travels when necessary thus saving battery, network bandwidth, and ultimately improving the real-time capabilities.

The Top Three

In this protocol the central communication point is the MQTT broker, it is in charge of managing all messages between the senders and the receivers; as would be the MQTT broker of Ubidots. To interact with an MQTT broker you’ll need an MQTT client, which is the one in charge of publishing/subscribing messages to the broker. The MQTT client includes a topic into the message, it is in charge of routing the information to the MQTT broker.

Now a day there are many tools that let you simulate an MQTT client without using any hardware, you need only establish the communication between the MQTT broker and the MQTT client! Below you will find Ubidots top 3 tools for simulating MQTT requests.

1. MQTTLens

This tool can be installed via the Google Chrome Web Store with just one click, making it easy and convenient to get started. MQTTLens connects to an MQTT broker and is able to publish and subscribe to MQTT topics using an interface simple and easy to grasp, making it one of the most common used in this world.

MQTTLens allow connections to more than one broker at the same time, supporting all the available connections options from the MQTT spec, but not persistent sessions. A cool feature is the display of JSON payloads which is presented in a nice way and can easily understand.

MQTTLens is particularly well suited for people who need basic pub/sub functionality without having power needs.

To get a better idea of how it works, you can refer to this video tutorial.

MQTT.fx is an MQTT Client written in Java and based on Eclipse Paho. Due to the native packaging available for JavaFX, there are binaries for Windows, MacOSX, and Linux, which makes the installation a breeze, MQTT.fx aims to be quick and easy to use desktop tool for MQTT debugging and testing.

This tool supports import/export of Topics and Clipboard messages. Furthermore, standard publish/subscribe functionality provides support for $SYS topics and connection profiles for connecting to different brokers. The connection profiles allow the configuration of connection options like client id, SSL/TLS, username/password and Last Will and Testament. Also, MQTT.fx lets you view publisher and subscriber at the same time by detaching one of the tabs.

MQTT-Spy has a very nice way to display basic MQTT publish/subscribe mechanisms. Having different tabs for connections to several brokers, it makes it easy to publish and subscribe at the same time!

The areas of the pub/sub window are published, new subscription, subscription & messages, These can be closed to make room for currently operational windows. MQTT-Spy also comes with advanced features like scripting, filtering, searching, decoding & formatting on received messages, and graphing/charts.

Another handy feature is that it logs every published and received a message in the standard output into a file for simple access. It is easy to open the file in any text editor and make a deeper analysis of the messages, which is often necessary when dealing with many MQTT messages.

Tools to simulate an MQTT client

Now that you have the tools needed it to simulate an MQTT client, you can test with the Ubidots’ MQTT broker. Please reference the MQTT API reference for additional information on subscribing and publishing requests.

There are a number of tools to publish or subscribe on MQTT topics, which make this easier, but this top 3 will help you start working with MQTT! Reference to the official MQTT website where you can find a list of these tools and more exploration.

To visualize your data over MQTT into clearly organized and easily understood charts, tables, and other visualization widgets, send your data to the Ubidots IoT Application Development Platform to visualize and deploy your Applications using MQTT today.