Learn about the messaging capabilities that MQ telemetry transport (MQTT) brings to mobile platforms and devices. It’s a lightweight protocol designed to minimize network traffic and quickly and simply bring the reliability of messaging applications written for these environments.
MQTT can be used for mobile apps and also for telemetry and sensor machine-to-machine (M2M) apps.
For apps running on mobile devices, such as smartphones and tablets, MQTT offers a highly scalable publish/subscribe protocol with assured delivery. This saves the mobile app developer having to deal with connectivity logic for their application. Large numbers of mobile apps can connect into the enterprise using MQTT coming into an IBM MQ server. See Servers for Mobile Messaging & M2M.
Telemetry is the automated sensing, measurement of data, and control of remote devices. The emphasis is on the transmission of data from devices to a central control point. Telemetry also includes sending configuration and control information to devices.
An MQTT app can connect these small and often remote devices using the MQTT protocol. IBM MQ bridges between devices connected with the MQTT protocol and the enterprise. The bridge makes it easier to build "smart solutions". Smart solutions unlock the wealth of information that can be provided to business by integrating this sensor and device information with the rest of the business. Two examples of smart applications based on telemetry are smart electricity, and smart health services.
- An MQTT message that contains energy usage data sent to service provider.
- A telemetry application sends control commands that are based on analysis of energy usage data.
- For more information, see Telemetry scenario: Home energy monitoring and control.
- A telemetry application sends your health data to your hospital and doctor.
- MQTT message alerts or feedback can be sent based on analysis of your health data.
- For more information, see Telemetry scenario: Home patient monitoring.
The MQTT protocol is lightweight in the sense that clients are small, and it uses network bandwidth efficiently. The MQTT protocol supports assured delivery and fire-and-forget transfers. In the protocol, message delivery is decoupled from the application. The extent of decoupling in an application depends on the way an MQTT client and MQTT server are written. Decoupled delivery frees up an application from any server connection, and from waiting for messages. The interaction model is like email, but optimized for application programming.
The MQTT V3.1 protocol is a fully published specification that was jointly authored by IBM and Eurotech; see MQTT V3.1 Protocol Specification. The specification identifies a number of distinctive features about the protocol:
- It is a publish/subscribe protocol.
- In addition to providing one-to-many message distribution, publish/subscribe decouples applications. Both features are useful in applications that have many clients.
- It is not dependent in any way on the message content.
- It runs over TCP/IP, which provides basic network connectivity.
- It has three qualities of service for message delivery:
At most once
- Messages are delivered according to the best efforts of the underlying Internet Protocol network. Message loss might occur.
- Use this quality of service with communicating ambient sensor data, for example. It does not matter if an individual reading is lost, if the next one is published soon after.
At least once
- Messages are assured to arrive but duplicates might occur.
- Messages are assured to arrive exactly once.
- Use this quality of service with billing systems, for example. Duplicate or lost messages might lead to inconvenience or imposing incorrect charges.
- It is economical in the way it manages the flow of messages on the network. For example, the fixed-length header is only 2 bytes long, and protocol exchanges are minimized to reduce network traffic.
- It has a
Last Will and Testamentfeature that notifies subscribers of the abnormal disconnection of a client from the MQTT server. See Last will and testament publication.
MQTT version 3.1 is supported by IBM MQ and IBM MessageSight.
This developerWorks® Messaging community is a good starting point for MQTT developers who are writing applications for mobile platforms or telemetry devices.
MQTT.org is a good place to go to learn about and discuss implementations and extensions to the MQTT protocol.