Revert-RPCs (RRPCs) support using RRPC-specific topics for communication between IoT Platform and devices. This article describes RRPC-specific topics and how to initiate an RRPC request.

RRPC-specific topics

This following table describes the syntax of the RRPC-specific topics.

Topic Format Description
RRPC subscription topic /sys/${YourProductKey}/${YourDeviceName}/rrpc/request/+ Subscribes to RRPC request messages that are sent from IoT Platform.
RRPC request topic /sys/${YourProductKey}/${YourDeviceName}/rrpc/request/${messageId} Sends RRPC request messages from IoT Platform.
RRPC response topic /sys/${YourProductKey}/${YourDeviceName}/rrpc/response/${messageId} Sends RRPC response messages from devices.

Variables:

  • ${YourProductKey}: Replace this variable with the ProductKey of the product to which your device belongs.
  • ${YourDeviceName}: Replace this variable with the DeviceName of your device.
  • ${messageId}: Replace this variable with the ID of the RRPC message. When a server calls the RRpc operation to send a message to a device, IoT Platform generates a unique ID for the message.

Initiate an RRPC request

  1. IoT Platform sends an RRPC message.

    A server calls the RRpc operation to send a message to a device. For more information, see RRpc.

    The following example shows how to use Link SDK for Java to call the RRpc operation:

    RRpcRequest request = new RRpcRequest();
    request.setProductKey("testProductKey");
    request.setDeviceName("testDeviceName");
    request.setRequestBase64Byte(Base64.getEncoder().encodeToString("hello world"));
    request.setTimeout(3000);
    RRpcResponse response = client.getAcsResponse(request);
    Note Log on to the OpenAPI Developer Portal and call the RRpc operation. The sample code for multiple programming languages is provided.
  2. The device sends an RRPC response.

    After the device receives the RRPC request, the device returns a message to the response topic.

    The device extracts the messageId parameter from the /sys/${YourProductKey}/${YourDeviceName}/rrpc/request/${messageId} request topic, and generates an RRPC response topic to send the response to IoT Platform.

    Note Devices can return only the RRPC messages whose quality of service (QoS) level is 0.

Examples