If you do not use custom topics, Revert-RPC (RRPC) allows you to enable communication between devices and IoT Platform by using RRPC-specific topics. This topic describes RRPC-specific topics and how to initiate an RRPC request.

RRPC-specific topics

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

TopicFormatDescription
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("dGhpcyBpcyBhbiBleGFtcGxl");
    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 then generates an RRPC response topic to send the response to IoT Platform.

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

For more information, see Remotely control a Raspberry Pi server.