eclipse/paho.mqtt.c logo

eclipse/paho.mqtt.c

Free

An Eclipse Paho C client library for MQTT for Windows, Linux and MacOS. API documentation: https://eclipse.github.io/paho.mqtt.c/

FreeFree tier
Type
Open Source
Company
Eclipse Foundation

About eclipse/paho.mqtt.c

Eclipse Paho MQTT C client library provides a robust implementation of the MQTT protocol for C applications. It supports both synchronous and asynchronous programming models, enabling flexible publish/subscribe messaging with MQTT brokers. The library is available in four variants: paho-mqtt3a (asynchronous without SSL), paho-mqtt3as (asynchronous with SSL/TLS), paho-mqtt3c (classic synchronous), and paho-mqtt3cs (classic with SSL/TLS). Network protocol support includes TCP, SSL/TLS, Unix-domain sockets, and websockets (secure and insecure). The library is designed for cross-platform use on Windows, Linux, and macOS. Comprehensive API documentation is generated via Doxygen, and sample code (e.g., command-line utilities paho_c_pub, paho_c_sub) demonstrates usage. It adheres to MQTT 3.1.1 and 5.0 standards.

Key Features

Synchronous and asynchronous programming models
Four library variants: async/sync with or without SSL/TLS
Supports MQTT 3.1.1 and 5.0
Network protocols: TCP, SSL/TLS, Unix-domain sockets, websockets (secure and insecure)
Cross-platform: Windows, Linux, macOS
API documentation via Doxygen and online docs
Command-line sample utilities (paho_c_pub, paho_c_sub) and code examples
Eclipse open-source project under EPL 2.0

Pros & Cons

Pros
  • Open source with Eclipse governance and permissive licensing (EPL 2.0)
  • Multiple API models (sync and async) to match different application needs
  • Extensive network protocol support including websockets and Unix sockets
  • Good documentation with samples and detailed API references
  • Active community and long history of maintenance
  • Supports both MQTT 3.1.1 and 5.0 standards
Cons
  • C language only; no native C++ wrapper (requires C programming)
  • Manual memory management required, increasing development complexity
  • Low-level library; may be less approachable for beginners than higher-level MQTT clients
  • No built-in MQTT broker or client GUI; only provides client library

Best For

Connecting C/C++ applications to MQTT brokers for IoT messagingBuilding publish/subscribe clients for sensor data, telemetry, or remote controlIntegrating MQTT into embedded systems, desktop software, or server-side toolsUsing as a library in larger projects requiring flexible MQTT client capabilitiesDeveloping cross-platform MQTT applications with minimal dependencies

FAQ

What APIs does the Paho C library offer?
The library provides four variants: asynchronous (MQTTAsync) and synchronous (MQTTClient), each with optional SSL/TLS support. The asynchronous API is recommended for most use cases.
Does it support MQTT 5.0?
Yes, the library supports both MQTT 3.1.1 and MQTT 5.0 standards.
What operating systems are supported?
The library is designed for Windows, Linux, and macOS.
Can I use websockets with this library?
Yes, websockets are supported via the 'ws://' and 'wss://' URI schemes for both unsecured and secured connections.
Is there sample code available?
Yes, sample command-line tools (paho_c_pub, paho_c_sub) and simple code examples are included in the repository under src/samples and documented in the Doxygen-generated API docs.