HiveMQ Logo

MQTT Protocol

The Messaging and Data Exchange Protocol of the IoT

Get the MQTT Essentials eBook

72 pages of MQTT education and learning for beginners and experts alike.

The MQTT protocol is the de-facto standard for IoT messaging. Standardized by OASIS and ISO, MQTT publish/subscribe protocol provides a scalable and reliable way to connect devices over the Internet. Today, MQTT is used by many companies to connect millions of devices to the Internet.

Companies are using MQTT because:

  • It requires minimal resources since it is lightweight and efficient
  • Support bi-directional messaging between device and cloud
  • Can scale to millions of connected devices
  • Support reliable message delivery through 3 QoS levels
  • Works well over unreliable networks
  • Security enabled, so it works with TLS and common authentication protocols

Key Features

MQTT Client icon

MQTT Clients

MQTT clients publish a message to an MQTT broker and other MQTT clients subscribe to messages they want to receive. Implementations of MQTT clients typically require a minimal footprint so are well suited for deployment on small constrained devices and are very efficient in their bandwidth requirements.
HiveMQ develops a Java-based MQTT client that is available under an open source license.

MQTT Broker icon

MQTT Broker

MQTT brokers receive published messages and dispatch the message to the subscribing MQTT clients. An MQTT message contains a message topic that MQTT clients subscribe to and MQTT brokers use these subscription lists for determining the MQTT clients to receive the message.
HiveMQ offers a commercial and open source MQTT broker.

MQTT QoS icon

Quality of Service Levels

MQTT implements 3 quality of service levels for agreement between the sender and receiver: 1) At most once (0), 2) At least once (1), and 3) Exactly once (2). These QoS levels allow for more reliable IoT applications since the underlying messaging infrastructure and adapt to unreliable network conditions.

Persistent Sessions icon

Persistent Sessions

MQTT allows for a persistent session between the client and the broker. This allows for sessions to persist even if the network is disconnected. Once the network is reconnected, the information to reconnect the client to the broker still exists. This is one of the key features that makes the MQTT protocol more efficient than HTTP for use over unreliable cellular networks.

Retained Messages icon

Retained Messages

MQTT clients that subscribe to a new topic have no insight into when to expect the first message they will receive. However, an MQTT broker can store a retained message that can be sent immediately upon a new MQTT subscription. In this case, the MQTT client will receive at least one message upon subscribing to the topic.

Last Will and Testament icon

Last Will and Testament

An MQTT client can specify to an MQTT broker a message, called the last will, that will be sent if the MQTT client ungracefully disconnects. This allows for a more graceful system wide notification that a client has been disconnected.

Case Studies

circle-right-icon Read full story

BMW Share Now uses HiveMQ for reliable message connectivity for their car sharing application.

circle-right-icon Read full story

Automotive manufacturing IoT use case for using MQTT and HiveMQ.

circle-right-icon Read full story

Discover how Liberty Global is building their new digital media platform.

circle-right-icon Read full story

Matternet uses HiveMQ for real-time communication with medical transport drones.

MQTT Resources

Next Steps