Improve this article..
MQTT stands for MQ Telemetry Transport. (Note: MQ does not stand for Message Queue). It is a publish/subscribe messaging transport protocol. It has low complexity, small code footprint and consumes low network bandwidth for messaging. The lightweight protocol and small packet size support makes it suitable for applications such as Machine to Machine (M2M) and Internet of Things (IoT).
The protocol runs over network protocols like TCP/IP that provide ordered, lossless, bidirectional connections. MQTT-SN v1.2, MQTT for Sensor Networks (formerly known as MQTT-S), is a version of the protocol targetted for embedded devices on non-TCP/IP networks, such as Zigbee. Connectionless network transports such as User Datagram Protocol (UDP) are not suitable because packets may be lost or arrive out of order. The protocol enables transmit of messages either in 1-to-1 or 1-to-many configuration. The messaging transport is agnostic to the content of the payload.
What are the core features of MQTT?
The core features of MQTT are:
1) It is simple to implement
2) It is lightweight and network-bandwith efficient
3) The transport protocol is payload data agnostic
4) It provides a Quality of Service data delivery
5) It supports continuous session awareness
What model does MQTT use for communication?
MQTT uses publish/subscribe model or pattern. In this model, there is a publisher that sends a particular message. One or more subscribers, also called subscriber clients, who want to receive the message subscribe to it. A broker filters all incoming messages and distributes them to subscribers accordingly.
The main advantages of Publish/Subscribe protocol are that the publisher and client don't need to know each other and are not dependent on each other for initialization and synchronisation.
What was MQTT designed for and where is it popularly used today?
IBM originally designed MQTT protocol for communication between oil pipeline stations over low bandwidth satellite links. It was later used for applications such as home automation and message broadcasting to ferries.
How does the MQTT protocol work?
There is an intermediate central Server (or Broker) to which a publisher client can publish its messages and other subscriber clients can subscribe to required messages. The Server (or Broker) takes care of sending the publisher's messages to the subscriber clients. MQTT clients uses topics or topic names for addressing.
MQTT protocol defines three levels of Quality of Service (QoS) for messages delivered. They are:
1. Level 0: At most once delivery
2. Level 1: At least once delivery
3. Level 2: Exactly once delivery
MQTT Protocol supports the following Control Packet types:
Does MQTT support security?
MQTT is a transport protocol that concerns message transmission. So, security features such as privacy of data, authentication and authorization of users, etc. have to be taken care by the implementator. MQTT specification provides a guidance about the various implementations possible, such as TLS and security related aspects that need to be considered like geographic, industry specific and regulatory related.
For example, TLS or SSL security and payload encryption can be used to protect the contents of the MQTT messages.
1. Add username and password in the CONNECT packet
2. Include return codes in CONNACK packet to report security issues
What are the limiting factors of MQTT to consider while using it?
There are two limiting factors of MQTT. Firstly, the structure of the published data is not known to the subscriber. So, this information should be shared or known beforehand.
Secondly, the delivery of a message is not confirmed as there is no automatic confirmation from the recipient. Moreover, the publisher also does not know if there are any subscribers.
What software implementations of MQTT are available?
Several MQTT client libraries are available based on different languages and for supporting varied devices. Broker or Server implementations and tools are also available from different vendors. This information is available on the MQTT website.
- Boyd, Bryan. 2014. "MQTT - A practical protocol for the Internet of Things." LinkedIn. August 28. Accessed 2017-03-21.
- Dierks, T., and E. Rescorla. 2008. "The Transport Layer Security (TLS) Protocol Version 1.2", RFC 5246, August 2008
- Facebook MQTT. 2011. "MQTT used by Facebook Messenger", accessed March 4th, 2017
- MQTT Software. 2014. "mqtt/mqtt.github.io" accessed March 4th, 2017
- MQTT supplemental publication. 2014. "MQTT supplemental publication, MQTT and the NIST Framework for Improving Critical Infrastructure Cybersecurity", accessed March 4th, 2017
- NIST. 2017. "NIST Cybersecurity Framework" accessed March 4th, 2017
- OASIS Standard. 2014. "MQTT Version 3.3.1" Last modified October 2014.
MQTT was developed by Andy Stanford-Clark (IBM) and Arlen Nipper (Arcom Systems, later CTO of Eurotech).
MQTT protocol specification released to become part of ISO standard.
mqtt.org website launched.
MQTT 3.1.1 version released.
MQTT was officially approved as OASIS Standard.
- MQTT Website
- Bryan Boyd, Joel Gauci, Michael P Robertson, Nguyen Van Duy, Rahul Gupta, Vasfi Gucer, Vladimir. 2014. Building Real-time Mobile Solutions with MQTT and IBM MessageSight: IBM Redbooks. Accessed 2017-03-21.
- ISO/IEC MQTT v3.1.1 Standard 20922:2016