The revert-RPC (RRPC) feature of IoT Platform provides a synchronous request-response mechanism based on the MQTT protocol. You can achieve synchronous communication without changing the MQTT protocol. This article describes how to configure Link SDK for C to receive a synchronous message, process the command, and then send a response to IoT Platform.
Prerequisites
- A development environment is prepared.
- Link SDK for C is obtained.
When you customize an SDK, set Connect to IoT platform protocol to MQTT 3.1.1 on the SDK customization page.
- The device authentication information is obtained.
Background information
- For more information about the RRPC feature, see What is RRPC?.
- The RRPC feature allows you to use basic communication topics and custom topics to call the RRpc operation of IoT Platform and send messages to devices. For more information, see the following articles:
Process
The application program calls the API operations of Link SDK for C to connect with IoT Platform over MQTT, receive a synchronous message, and then send a response to IoT Platform.
The following figure shows the process. In this example, the demos/mqtt_rrpc_demo.c application program is used.
To use this feature, you must establish an MQTT connection. For more information about the related API operations, see aiot_mqtt_api.h.
Examples
- For more information about examples, see Example.
- For more information about error codes, see Common error codes.