MQTT (Message Queuing Telemetry Transport) is a publish/subscribe messaging protocol for constrained Internet of Things devices and low-bandwidth, high-latency or unreliable networks. Because MQTT specializes in low-bandwidth, high-latency environments, it is an ideal protocol for machine-to-machine (M2M) communication.
MQTT was first developed in 1999, but with the exponential growth of the Internet of Things, and the need to connect and communicate between low-powered smart devices, MQTT has recently found a market. MQTT was built to be a low-overhead protocol that strongly considered bandwidth and CPU limitations. It was designed with the ability to run in an embedded environment where it would reliably and effectively provide an avenue for communication.
MQTT fundamentally is a publish/subscribe protocol. It allows clients to connect as a publisher, subscriber, or both. You connect to a broker that handles all the message passing.
At the heart of using MQTT as a communication avenue is the topic. It’s a remarkably simple idea not unique to MQTT; however, the MQTT protocol leverages the power of this quite nicely. A topic implicitly accomplishes several tasks, most importantly ensuring that a message is delivered to the correct listeners. MQTT treats a topic as a file path. When thinking of a topic as a simple communication filter, the path application can become very powerful.
topic = "user/path/topic"
You could be interested in a particular higher level of the path or the leaf element. Without explicitly saying so, MQTT filters messages based on where you subscribe in the tree path. It’s a simple idea, that can be used very effectively.
Let’s dig a little deeper into the technical aspects of MQTT. First, the protocol runs on top of the TCP/IP networking stack. When clients connect and publish/subscribe, MQTT has different message types that help with the handshaking of that process. The MQTT header is two bytes and first byte is constant.
In the first byte, you specify the type of message being sent as well as the QoS level, retain, and DUP (duplication) flags. The second byte is the remaining length field. There is more information you can glean from the MQTT specification if you are interested.
With PubNub now supporting MQTT over our real-time, global Data Stream Network, we wanted to give an overview of the protocol and why you might or might not use it from our perspective.
You may already have deployed MQTT-based devices. Or you may be considering a new IoT deployment. Either way, the question arises, “When should I use MQTT, and when should I use PubNub?” And when does it make sense to use both? If you are considering robust, bi-directional communication options for your MQTT-based devices, PubNub provides enterprise-grade security, scalability and reliability, and many value-added features too, like functions-as-a-service, presence detection, and message storage and playback. And all this power is all available with a simple publish-subscribe command.
Like the proverbial peanut butter and chocolate, PubNub and MQTT together can elegantly solve many embedded device use cases. You can leverage PubNub with MQTT to satisfy use cases like low-latency, efficient anomaly detection. For example, say you have MQTT-based sensors on industrial, power-generating turbines. You can leverage PubNub – including the “Functions-as-a-Service” Functions – to react to and transmit sensor data in real time, so an operations team can identify turbine problems before data even touches a centralized data center. You can also leverage PubNub with MQTT-based home alarms to review signals across alarms and identify if there is a bad alarm that is sending false positives. And across use cases, you can leverage PubNub’s integrations to multiple machine learning services to detect anomalies.
If MQTT is not part of your current infrastructure, you might consider leveraging the PubNub Data Stream Network directly along with PubNub’s numerous IoT SDKs for all of your Internet of Things connectivity. Or the PubNub Network with MQTT can be a great choice for low-powered devices.
To utilize the PubNub Network with MQTT-enabled devices, you need to subscribe your devices to PubNub at mqtt.pubnub.com. Our PubNub Improves MQTT Support & IoT Capabilities guide walks you through the subscription steps in more detail.
There are common underlying technologies for a dating app, and in this post, we’ll talk about the major technologies and designs...