Revert-RPCs (RRPCs) support RRPC-specific topics for communication between IoT Platform and devices. This topic describes RRPC-specific topics and how to make RRPC requests.

RRPC-specific topics

This section describes the syntax of the RRPC-specific topics:

  • RRPC request topic: /sys/${YourProductKey}/${YourDeviceName} /rrpc/request/${messageId}
  • RRPC response topic: /sys/${YourProductKey}/${YourDeviceName} /rrpc/response/${messageId}
  • RRPC subscription topic: /sys/${YourProductKey}/${YourDeviceName} /rrpc/request/+

${YourProductKey} specifies the key of the product to which your device belongs. ${YourDeviceName} specifies the name of your device. ${messageId} specifies the unique RRPC message ID generated by IoT Platform.

Initiate RRPC requests

  • IoT Platform sends an RRPC message.

    You can call the RRpc operation on your server to send a message to a device. For more information about the RRpc operation, see RRpc.

    The following sample code shows how to use the Java SDK 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 You can use different SDKs to call the RRpc operation. For more information about sample code, visit OpenAPI Explorer.
  • The device sends an RRPC response.

    After receiving the RRPC request, the device returns a message to the response topic based on the required format.

    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:

Call a synchronous service

Control Raspberry Pi servers from IoT Platform