MQTT Protocol
MQTT Protocol
Introduction
Zilla supports MQTT (Message Queuing Telemetry Transport) as a protocol binding, designed for efficient, lightweight, and reliable messaging in modern distributed systems. MQTT operates over TCP/IP and is optimized for low-bandwidth, high-latency, or unreliable networks, making it ideal for IoT, real-time telemetry, and event-driven architectures. With features like publish-subscribe messaging, Quality of Service (QoS) levels, and persistent session support, MQTT enables scalable and resilient communication between devices and services.
MQTT Communication Workflow

MQTT Components
MQTT operates on a publish-subscribe model and consists of the following key components:
- Broker: The central server that receives, filters, and distributes messages between clients.
- Publisher: A client that sends messages to a specified topic on the broker.
- Subscriber: A client that listens for messages on a topic from the broker.
- Message: The data payload sent from a publisher to subscribers via the broker.
- Topic: A hierarchical string that defines where messages are published and subscribed to.
- QoS: The level of guarantee for message delivery, ranging from at-most-once (0) to exactly-once (2).
- Session: The connection state maintained between a client and the broker, tracking subscriptions and queued messages.
MQTT Connections
- Connection Initiation: The MQTT client sends a CONNECT packet to the broker, requesting a connection.
- Connection Acknowledgment: The broker responds with a CONNACK packet, either confirming or denying the connection request.
- Session Establishment: If the connection is accepted, a session is established between the client and the broker.
- Subscription: The client sends SUBSCRIBE packets to the broker to register its interest in specific topics. The broker then responds with SUBACK packets, confirming the client's subscriptions.
- Publishing: The client sends PUBLISH packets to the broker to send messages on specific topics. The broker then forwards the published messages to all clients subscribed to the corresponding topics.
- Maintaining the Connection: The client and broker exchange PINGREQ and PINGRESP packets to ensure the connection remains active.
- Disconnection: Either the client or the broker can initiate disconnection by sending a DISCONNECT packet.
MQTT Packet Structure

- Fixed header – The mandatory part of an MQTT packet that includes essential control information.
- Control field – Specifies the MQTT packet type and flags for message handling.
- Remaining length – Indicates the number of bytes following the fixed header, including the variable header and payload.
- Variable header – An optional section that contains additional information depending on the packet type, such as packet identifiers or topic names.
- Payload – The actual data being transmitted, which varies based on the packet type and may contain messages, topic filters, or authentication data.1.
Supported Versions
Differences Between MQTT v3.1.1 and MQTT v5.0
Feature | MQTT 3.1.1 | MQTT 5.0 |
---|---|---|
Error Reporting | Limited error reporting | Extended reason codes for detailed responses |
Session Expiry | No session expiry option | Allows configurable session expiry time |
Authentication | Uses simple username/password | Uses AUTH packet that supports challenge-response authentication |
Message Handling | Limited payload description | Payload format indicator, content type, topic aliases |
Security
Securing MQTT with TLS
MQTT is a lightweight messaging protocol widely used for IoT communication. To ensure secure data transmission, it is essential to encrypt MQTT traffic using TLS (Transport Layer Security). This prevents unauthorized interception, data tampering, and man-in-the-middle (MITM) attacks.
Zilla provides support for TLS bindings to enforce secure communication between MQTT clients and brokers, ensuring that all messages are encrypted in transit.
JWT Guard
A client connection to the MQTT server can be guarded by the jwt guard supporting JWT access tokens, with fine-grained privileges enforced on publish or subscribe to MQTT topics.
Zilla: Beyond Standard MQTT
Zilla enhances traditional MQTT workflows by integrating advanced validation, seamless protocol bridging, and dynamic access control.
- Data Governance: Validate MQTT topics, payloads, and headers with Schema Registry support.
- Protocol Mapping: Enable seamless pub/sub communication with Kafka through native Kafka Wire Protocol integration.
Zilla: MQTT Use Cases
Zilla leverages MQTT Protocol to provide efficient message brokering, real-time event streaming, and reliable device communication.
- MQTT Kafka Proxy
Reference
mqtt binding Defines a binding with mqtt
protocol support, with server
or client
behavior.
mqtt-kafka binding The proxy
kind mqtt-kafka
binding adapts MQTT topic streams to Kafka topic streams .