Stand with Ukraine flag
Pricing Try it now
Community Edition
Getting Started Documentation Devices Library Guides Installation Architecture API FAQ

rpc call reply

Since TB Version 2.0

image

Sends response to the RPC Call originator. All incoming RPC requests are passed through Rule Chain as Messages. Also all RPC requests have request ID field. It is used for mapping requests and responses. Message Originator must be a Device entity because RPC response is initiated to the Message Originator.

Node configuration has special request ID field mapping. If the mapping is not specified, requestId metadata field is used by default.

image

RPC request can be received via different transports:

  • MQTT
  • HTTP
  • CoAP

Message payload example:

1
2
3
4
5
6
7
{
"method": "setGpio",
"params": {
"pin": "23",
"value": 1
}
}

Message will be routed via Failure chain in the following cases:

  • Inbound Message originator is not a Device entity
  • Request id is not present in the Message metadata
  • Inbound Message payload is empty

For more details how RPC works in the Thingsboard, please read RPC capabilities Article.

You can see the real life example, where this node is used, in the next tutorial: