Paho MQTT C Client Library
|
An MQTT client library in C.© Copyright IBM Corp. 2009, 2018
These pages describe the original more synchronous API which might be considered easier to use. Some of the calls will block. For the new totally asynchronous API where no calls block, which is especially suitable for use in windowed environments, see the MQTT C Client Asynchronous API Documentation. The MQTTClient API is not thread safe, whereas the MQTTAsync API is.
An MQTT client application connects to MQTT-capable servers. A typical client is responsible for collecting information from a telemetry device and publishing the information to the server. It can also subscribe to topics, receive messages, and use this information to control the telemetry device.
MQTT clients implement the published MQTT v3 protocol. You can write your own API to the MQTT protocol using the programming language and platform of your choice. This can be time-consuming and error-prone.
To simplify writing MQTT client applications, this library encapsulates the MQTT v3 protocol for you. Using this library enables a fully functional MQTT client application to be written in a few lines of code. The information presented here documents the API provided by the MQTT Client library for C.
Using the client
Applications that use the client library typically use a similar structure:
Some simple examples are shown here:
Additional information about important concepts is provided here: