Run Resource

Message to run a resource in a device or in the broker.

This message enables running remote resources defined both in client and server. Resources are defined dynamically by clients and servers. As described in the resources definition, a resource is basically like a function that can be executed like in RPC (Remote Procedure Call). As a "function" it can receive inputs, and provide an output.

A device can define multiple resources as required by its use case, i.e., read humidity, adjust temperature, turn on a light, etc. Typical resources for an IoT device are functions for reading device states, sensor values, adjust parameters, or actuating over digital pins to mention a few.

A server or broker can also define multiple resources that can be executed by their clients. Such resources can vary depending on the use case, and normally involves complex task that are not worth to be executed in the device. Typical resources defined by a server can be actions like writing to a database, calling an external endpoint for sending communications, managing device configuration, etc.

Request

FieldValueDescription

Message Type

0x06

Run

Message Size

Remaining Message Length

Body

NameFieldTypeMandatoryDescription

Resource

0x00

any

Stream Id

0x01

varint

Stream identifier. If set, the target endpoint should answer to the run message. If not, it should not send back any response.

Parameters

0x02

any

Resource parameters to be supplied while executing the resource.

Payload

0x03

any

The payload sent to the target resource.

Responses

OK

The resource executed correctly.

Error

An error occurred while executing the resource.

Last updated