With RRPC method, you can establish communications between devices and IoT Platform by using system-defined topics. These topics include the ProductKey and DeviceName of the devices.

System-defined topics

The formats of system-defined topics that are used in RRPC calls are as follows:

  • 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/+

In the topic formats, ${YourProductKey} and ${YourDeviceName} are device information used to identify a device, and ${messageId} is the RRPC message ID issued by IoT Platform.

Use RRPC

  1. Call RRpc API

    Call the RRpc API and input your device information into the SDK. For API calling method, see RRpc.

    The following example uses Java SDK to show the calling method:

    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);
  2. The device returns the response.

    When the device receives the RRPC request message, it returns a RRPC response message based on the request topic format.

    The device extracts the message ID from the request topic, /sys/${YourProductKey}/${YourDeviceName}/rrpc/request/${messageId}, generates a corresponding response, and then sends a response message to IoT Platform.