Message Queuing Telemetry Transport (MQTT) is a publish/subscribe messaging transport protocol for use on top of the TCP/IP protocol. It is simple, lightweight, and open. These characteristics make it ideal for use in many situations, including constrained environments such as for communication in Machine to Machine (M2M) and Internet of Things (IoT) contexts.

MQTT infrastructure is easily scalable and therefore used for communication of thousands of devices. It can be used to transmit sensor data, device states, tracking information, events, configuration data and much more.

Why SEGGER’s MQTT Client emMQTT?

SEGGER’s MQTT Client works with any MQTT Broker which adheres to the v3.1.1 standard. This makes it possible to add it to an end application with full confidence that everything will simply work.

Sample applications and demos are available for all popular brokers. A Microsoft Windows sample can be used to see just how easy it is to work with SEGGER’s MQTT Client.

SEGGER has developed the MQTT Client emMQTT from scratch to keep stack usage as small as possible and memory requirements to a minimum.

Key features

  • Full MQTT version 3.1.1 support
  • Publish/subscribe client included
  • Support for Quality of Service data delivery
  • Low memory footprint
  • Independent of the TCP/IP stack: any stack with sockets can be used
  • Publisher and subscriber demo included
  • Project for executable on PC for Microsoft Visual Studio included

MQTT Background

MQTT Background

MQTT is a very lightweight communication protocol originally designed for communication in M2M contexts. It is easy to implement on client side and has only a minimal packet overhead. This makes it ideal for the use with devices with limited resources.

It uses the publish/subscribe pattern, which is an alternative to the well-known client/server model. In opposite to the client/server model, where a client directly communicates with an endpoint, the publish/subscribe pattern decouples the sender and receiver of a particular message. In the MQTT context the sending client is called publisher, the receiving client subscriber.

Publisher and subscriber do not know about the existence of one another. To enable the transport of a message a third party is required. The service provided by the third party is called broker in the MQTT context. The broker filters all incoming messages from the publishers and distributes them to the subscribers.

MQTT uses subject-based filtering of messages. Publishers sends topic related messages, subscribers receive messages if they have subscribed the topic.

To get messages a from an MQTT broker a subscriber establishes a connection to the broker. The broker checks if a publisher has sent a message for the subscribed topic and if so, sends it to the subscriber. The advantage of this approach is that publisher and subscriber do not need to know each other and that they do not need to run at the same time. All they need to know is the IP address of the broker.

Getting Started with emMQTT

To easily get started with emMQTT and to evaluate the use of it, an MQTT Client Application using emMQTT is available for download.

The MQTT Client Application is a simple commandline-based MQTT client to connect to any MQTT broker.
It uses emMQTT and the emSSL SSL/TLS library on top of the host’s (i.e. Windows) native TCP/IP stack.

All features available in the MQTT Client Application can be used the same way on any embedded target system.

emMQTT Client App

emMQTT Application Usage

MQTT App Usage


MQTTClient --pub -h mqtt.eclipse.org -p 1883 -t SEGGER/Demo -m "Hello World from SEGGER MQTT."
Connect to broker at mqtt.eclipse.org:1883 and publish “Hello World from SEGGER emMQTT.” to “SEGGER/Demo” every second.

MQTTClient --sub -h mqtt.eclipse.org -p 1883 -t SEGGER/Demo
Connect to broker mqtt.eclipse.org:1883 and subscribe to “SEGGER/Demo” to receive all published messages from that topic.

MQTTClient --pub -h 1a2b3c4d5e6f7g.iot.eu-central-1.amazonaws.com -p 8883 -t SEGGER/Demo -m "Hello World from SEGGER MQTT." --tls --cert C:\Temp\aws_cert.der --key C:\Temp\aws_private.der -d 5
Securely connect to broker at 1a2b3c4d5e6f7g.iot.eu-central-1.amazonaws.com:8883 using TLS with certificate file aws_cert and private key file aws_private to publish “Hello World from SEGGER MQTT.” to “SEGGER/Demo” with 5 second delay.

MQTT Broker

The counterpart to an MQTT Client is the MQTT Broker. All MQTT Clients connect to one MQTT Broker to subscribe or publish to topics. The MQTT broker manages all client connections and sends published messages to subscribers. An MQTT broker is usually a server, running locally or in a cloud infrastructure. It can be connected to other software, such as a database to further process messages or a job scheduler to send messages on certain events. There are various MQTT brokers available, for commercial or non-commercial use, for local or server installation or as a hosted service, with and without further backend software.

emMQTT can connect to any MQTT broker that supports MQTT Version 3.1.1.

Broker Overview

emMQTT can be used with any MQTT broker. The following table provides an overview of some brokers the add-on has been tested with.
Do you miss your broker or cloud provider in this list? emMQTT will still be an option for you. Simply test connecting to your broker using the MQTT Client Application.

Broker / ServicePlain MQTTMQTT over TLSMQTT over TLS
with Client Certificate
mosquittoSupportedSupportedSupportedOpen-source MQTT broker for Linux, Windows, macOS. Tested with public broker at mqtt.eclipse.org
HiveMQSupportedOptionally available 1Optionally available 1Enterprise MQTT broker for Linux servers. Tested with public broker at hivemq.com
AWSNot SupportedNot SupportedSupportedAWS supports MQTT to connect to the AWS IoT Message Broker.

1: Not available on public broker.


TCP/IP Stack

emMQTT Client is a software component that works on top of TCP and requires a TCP/IP stack. It is optimized for emNet, but any RFC-compliant TCP/IP stack can be used. The integration of a TCP/IP stack is easily done with a simple API callback structure. A demo application for Windows which uses the standard Windsock API is available for download.
emMQTT can also be used with other protocols that work on top of TCP, such as SSL/TLS for secure communication or WebSockets for bowser-based applications.

Resource Usage

The ROM usage depends on the compiler options, the compiler version and the used CPU. The memory requirements of emMQTT presented in the tables below have been measured on a Cortex-M4 system.

The following resource usage has been measured on a Cortex-M4 system using SEGGER Embedded Studio V3.34, size optimization.

Resource UsageValue
emMQTT Client Size (ROM)Approx. 2.4 kByte
emMQTT Client Size (RAM)8 Byte
emMQTT Client Context (RAM)76 Byte


emMQTT is available under various Embedded Software License models and delivered in source code packages. With a wide range of licensing options, emMQTT can fulfill commercial requirements as well as technical requirements. All licenses are one-time payments. emMQTT is royalty-free and not subscription-based. This makes the software a part of the equipment expenses, keeping the costs static.

* Applies to second seat/product and all additional seats/products of the Single Product License and Single Developer License.