Thingsboard allows you to send remote procedure calls (RPC) from server side applications to devices and vise versa. Basically, this feature allows you to send commands to devices and receive results of commands execution. Similar, you can execute request from the device, apply some calculations or other server-side logic on back-end and push response back to the device. This guide covers Thingsboard RPC capabilities. After reading this guide, you will get familiar with following topics:
Thinsboard RPC feature can be divided into two types based on originator: device-originated and server-originated RPC calls. In order to use more familiar names, we will name device-originated RPC calls as a client-side RPC calls and server-originated RPC calls as server-side RPC calls.
Server-side RPC calls can be divided into one-way and two-way:
One-way RPC request is sent to the device without delivery confirmation and obviously, does not provide response from device. RPC call may fail only if there is no active connection with the target device within configurable timeout period.
Two-way RPC request is sent to the device and expects to receive response from the device within certain timeout. Server-side request is blocked until the target device will reply to the request.
Thingsboard provides convenient API to send and receive RPC commands from applications running on the device. This API is specific for each supported network protocol. You can review API and examples in corresponding reference page:
Thingsboard provides System RPC Plugin that allows you to send RPC calls from server-side applications to the device. In order to send RPC request you need execute HTTP POST request to the following URL:
The request body should be a valid json object with two elements:
Please note that in order to execute this request, you will need to substitute $JWT_TOKEN with a valid JWT token. This token should belong to either
You can use following guide to get the token.
See widgets library for more details.