eclipse/paho.mqtt.embedded-c logo

eclipse/paho.mqtt.embedded-c

Free

Paho MQTT C client library for embedded systems. Paho is an Eclipse IoT project (https://iot.eclipse.org/)

FreeFree tier
Type
Open Source
Company
Eclipse Foundation

About eclipse/paho.mqtt.embedded-c

Eclipse Paho MQTT C/C++ client library for embedded platforms, part of the Eclipse IoT project. The library is dual-licensed under EPL and EDL, allowing embedding without requiring contributions back under EDL. It contains three sub-projects: MQTTPacket (low-level serialization/deserialization of MQTT packets with helper functions), MQTTClient (higher-level C++ client with pluggable networking), and MQTTClient-C (C equivalent of MQTTClient). Supported platforms include Linux, Arduino, and ARM mbed. The library provides CMake build support and debug tracing via MQTT_DEBUG preprocessor definition. The repository includes sample code and Doxygen documentation.

Key Features

Three sub-projects: MQTTPacket (low-level), MQTTClient (C++), MQTTClient-C (C)
Dual-licensed under EPL and EDL (EDL allows embedding without contributing changes back)
Pluggable networking – separate classes for Linux, Arduino, and mbed
CMake build system with Travis-CI automated testing
Debug tracing via MQTT_DEBUG preprocessor definition
Sample code and Doxygen documentation included

Pros & Cons

Pros
  • Open source and dual-licensed (EPL/EDL) – flexible for proprietary use
  • Supports both C and C++ – suitable for a wide range of embedded environments
  • Actively maintained as an Eclipse IoT project with community support
  • Well-documented with samples and Doxygen
  • Lightweight and modular – use only the sub-project you need
Cons
  • Lower-level MQTTPacket requires manual network read/write – no built-in I/O
  • C++ client may not be available on all embedded C-only compilers
  • Limited to MQTT protocol – no support for other IoT protocols out of the box

Best For

Embedded IoT devices communicating via MQTT protocolMicrocontroller-based projects needing MQTT client functionalityPorting MQTT to new embedded platforms using the starter Porting GuideLinux-based edge devices requiring a lightweight MQTT library

FAQ

What is the difference between MQTTPacket, MQTTClient, and MQTTClient-C?
MQTTPacket is the lowest-level library providing serialization and deserialization of MQTT packets without networking code. MQTTClient is a higher-level C++ client with pluggable networking classes. MQTTClient-C is a C equivalent of the C++ client for platforms where C++ is not supported.
What are the licensing options for this library?
The library is dual-licensed under the Eclipse Public License (EPL) and the Eclipse Distribution License (EDL). You can choose which license to use. The EDL allows embedding the code into your application without contributing your changes back.
Which platforms are supported?
Currently there are networking implementations for Linux, Arduino, and ARM mbed. The design allows you to write your own networking class for other platforms.
How do I enable debug tracing?
Set the MQTT_DEBUG preprocessor definition to enable debug tracing of MQTT packets sent and received.