Message Queuing Telemetry Transport (MQTT) is a lightweight, asynchronous messaging protocol built on TCP/IP that uses a publish/subscribe model. Link SDK for C implements MQTT 3.1.1 and handles connection management, keep-alive, and message delivery, so your application only needs to call the SDK's API operations to connect devices to IoT Platform.
Prerequisites
-
When you customize an SDK, set the Connect to IoT platform protocol parameter to MQTT 3.1.1 on the SDK customization page.
-
Device authentication credentials are obtained. Use one of the following methods:
Authenticate the device using a device certificate issued by IoT Platform. See Obtain device verification information.
Authenticate the device using custom credentials. See Add devices to an MQTT gateway product.
Background
For devices connecting directly to IoT Platform over MQTT (non-cloud gateway), see MQTT protocol.
For cloud gateway devices connecting over MQTT, see MQTT gateways.
How it works
Link SDK for C is designed for resource-constrained devices running C applications. The SDK manages the full MQTT connection lifecycle — authentication, keep-alive, and reconnection — so your application code only needs to call the SDK's API operations to publish messages and subscribe to topics.
The following figure shows how a device-side application connects to IoT Platform using Link SDK for C.
For the full list of MQTT connection API operations, see aiot_mqtt_api.h.

Examples
For end-to-end code samples showing how to establish an MQTT connection, see Example.
For a reference of SDK error codes returned during connection, see Common error codes.