Vehicle Communication and Networking · Messaging protocol
MQTT
Also known as MQTT 5.0, MQTT v5, MQTT broker
A lightweight client-server publish-subscribe messaging protocol, standardised by OASIS, in which clients publish messages to topics on a broker that forwards them to subscribers. It is used for automotive and IoT telemetry.
Explanation
MQTT runs over TCP/IP, or over any other network protocol that provides ordered, lossless, bidirectional connections. Clients connect to a broker (the server), publish messages to hierarchical topic names and subscribe to topic filters. The broker decouples publishers from subscribers, which need not know about each other. MQTT Version 5.0 became an OASIS Standard on 7 March 2019.
Three quality-of-service levels trade overhead for delivery guarantees: QoS 0 (at most once), QoS 1 (at least once) and QoS 2 (exactly once). Retained messages give new subscribers the last known value on a topic, and a will message lets the broker announce a client's unexpected disconnection. Version 5.0 adds reason codes to acknowledgements and lets the server advertise limits such as a maximum supported QoS.
QoS applies to each hop between client and broker rather than end to end, and the broker is a central dependency that must be scaled and secured; TLS and authentication are configured separately. MQTT suits telemetry and commands between vehicles and the cloud rather than hard real-time in-vehicle control.
How it works
A client opens a TCP connection, often protected by TLS, and sends CONNECT. To publish, it sends PUBLISH with a topic, payload and QoS. For QoS 1 the receiver answers with PUBACK, and for QoS 2 a four-step handshake prevents duplicates. The broker matches the topic against subscriptions, including wildcard filters, and forwards the message to each subscriber at no more than the QoS granted for that subscription.
Automotive applications
- Vehicle telemetry upload to cloud back-ends
- Remote commands such as pre-conditioning or door unlock
- Fleet and charging-station monitoring
- Streaming test-bench data
Example
A telematics unit publishes battery state of charge every minute to the topic fleet/VIN123/battery/soc with QoS 1 and the retain flag set. A fleet dashboard that connects later immediately receives the latest value from the broker.
An illustrative example: any figures in it are worked numbers, not measurements.
Standard details
- Standard
- MQTT Version 5.0
- Edition
- OASIS Standard, 7 March 2019
- Publication status
- Published (OASIS Standard)
- Scope
- Specifies a client-server publish/subscribe messaging transport protocol for constrained and networked environments.
- How this was checked
- Status from the OASIS specification page.
References
- MQTT Version 5.0, OASIS Standard, 07 March 2019 (opens in a new tab)
“MQTT is a Client Server publish/subscribe messaging transport protocol.”
- MQTT: The Standard for IoT Messaging (opens in a new tab)
“MQTT is an OASIS standard messaging protocol for the Internet of Things (IoT).”
Definitions are original summaries. Standards text is not reproduced; follow the links for the official publications.