MQTT (originally called Message Queueing Telemetry Transport) is a simple “publish and subscribe” messaging protocol for use over TCP/IP. It was designed to connect restricted devices in remote locations for sporadic messaging over low bandwidth, high-latency or unreliable networks, with minimal code size needed. Its original purpose was to collect data from multiple devices while using limited bandwidth and provide the information to several subscribers. It tries to ensure reliability and some degree of assurance of delivery. MQTT is now mainly used as a Machine-to-Machine (M2M) Internet of Things (IoT) connectivity protocol.
This module is part of the HCC MISRA-compliant TCP/IP stack, as shown in the Networking Overview diagram, and is designed specifically for use with it. It uses verifiable TLS for secure connections to handle encryption independently of MQTT. A client can also provide a user name and password so that the broker can authenticate the client. When MQTT operates over a TLS connection, both the client and the server can authenticate each other using X.509 certificates.
MQTT is an Application Layer protocol that operates over TCP, normally using one of two ports: 1883 for clear data and 8883 for connections over Transport Layer Security (TLS). The protocol provides many useful capabilities, including different levels of “Quality of Service” (QoS), “client down” notification, automatic topic re-registration, and the ability to receive data from clients that have gone offline.
MQTT is ideal for mobile applications because of its small size, low power usage, minimized data packets, and efficient distribution of information to one or many receivers. It involves many “clients” communicating with a centralized server (“broker”) that distributes messages among the interested clients that have subscribed to the appropriate “topic”. For example, it is used in sensors communicating to a broker via satellite link, over occasional dial-up connections with healthcare providers, and in a range of home automation and small device scenarios.
MQTT enables an embedded device to publish and receive messages from the cloud using just a few lines of code. It has minimal packet overhead, compared to protocols like HTTP, and clients are easy to implement.
With an application-defined “topic”, a client publishes free-format data to a broker. This data is transmitted by the broker to other client(s) that have subscribed to that topic. Through use of wildcards, a single subscription can result in data from many clients being received. Similarly, data from a single publish action may be provided to many clients.
- Conforms to the HCC Advanced Embedded Framework.
- Complies with the HCC MISRA-compliant TCP/IP stack.
- Designed for integration with both RTOS and non-RTOS based systems.
- Compliant with v3.1.1 of the specification, which is available at MQTT.org.
- Fully configurable.
- Users can publish and subscribe to topics.
- Supports Quality of Service (QoS) levels 0, 1 and 2.
- Supports Last Will and Testament/”Client Down” messages.
- Supports use of retained messages.
- Supports Clean Session/Continuous Session Awareness.
- Provides security using user name and password authorization.
- Provides security using TLS, with the additional option of authentication using X.509 certificates.