Describe Resources

Message to discover available resources in endpoints

This message enables discovering remote resources defined both in client and server. Resources can be 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 parameters, inputs, and provide an output.

This message allows discovering such resources, like its names, function type, if they support streaming, required parameters, etc.

Request

FieldValueDescription

Message Type

0x07

Describe Resources

Message Size

Remaining Message Length

Body

NameFieldTypeMandatoryDescription

Stream Id

0x01

varint

Parameters

0x02

any

Params

Resource

0x03

any

Resource identifier. It should be a string or a resource identifier. If not sent, the target endpoint should report all available resources.

If not resource is specified, the target endpoint should list all available resources.

Response (All Resources)

If no resource is specified while sending the Describe Resources message, the target endpoint should list all available resources,

Ok

If the request succeed, the remote endpoint should return an Ok Message with the following payload:

{
  "relay": {
    "fn": 2
    "id": 0
  },
  "temperature": {
    "fn": 3
    "id": 1
  },
  "reset" : {
    "fn": 1,
    "st": false,
    "id": 2
}

In such document each key represents the resource name

Describe FieldKeyValueMandatoryDescription

Function Type

fn

1 : function without parameters

2 : function with input

3: function with output

4: function with input and output

Provides information about the function type, i.e., if it requires and input, provides an output, none, or both of them.

Parameters

pr

true: requires parameters

false: no parameters required

Determines if the resource requires parameters to be executed. By default, if not specified, the resource does not require parameters to be executed.

Stream

st

true: support Stream

false: no stream support

Determines if the resource can be used with the Streams functionality. By default, if not specified, the stream support is enabled.

Resource identifier

id

varint

An alternative numeric resource identifier, instead of a name, that can be used to call this resource.

Error

The resources cannot be described, i.e., no support for describing resources.

Response (Single Resource)

If a resource is specified while sending the Describe Resources message, the target endpoint should reply with the resource details.

Ok

If the request succeed, the remote endpoint should return an Ok Message with the following payload:

{
  "in": true
}
{
  "out": 22.33
}  
{
  "in": 0
  "out": 25
}

Error

The resource cannot be described, i.e, it does not exists.

Last updated