Xentara WebSocket API Specification v2.1
User Manual
Format
See also
RFC 8949 - Concise Binary Object Representation (CBOR)
Concise Binary Object Representation (CBOR) Tags

Format for Enumerated Alternative Data

Xentara WebSocket interface utilizes a designated range of CBOR Tag numbers specifically allocated for representing Enumerated Alternatives Data.

For instance, data reflecting the outcome of an action can manifest in either a failure scenario, accompanied by error details, or a success scenario, yielding a result. The allocation of tag numbers for these alternatives, as well as the expected data format for each scenario, is determined by individual supported commands.

For example, in the case of the Read Command, successful outcomes are encapsulated within the tag number 121:

121(true)

Conversely, error values are encoded within the tag number of 122:

122({0: -32101, 1: "missing attribute"})

Format for UUIDs

The representation of UUIDs within Xentara WebSocket packets adheres to a standardized encoding method. Specifically, this is achieved by utilizing Tag 37 (Binary UUID), which is applied to a Byte string. The tag number 37 signifies that the byte string represents a binary UUID.

For example, the UUID B4E1C552-E3C7-406B-95A2-AA09C553F277 is represented as follows:

37(h'B4E1C552E3C7406B95A2AA09C553F277')

Format for Timestamps

In the Xentara WebSocket packets, timestamps are encoded to ensure precise and flexible time representation between the server and the client. This encoding format is structured to handle various levels of time precision and special cases effectively.

Timestamp with Tag 1001

Timestamps can be encoded with CBOR Tag 1001, which denotes an Extended Time format. This tag encapsulates a map containing specific keys and values that represent the timestamp.

Keys and Values

  1. Key 4:
    • Value Format: Encoded with Tag 4, representing a Decimal fraction.
    • Structure: An array of two elements: the first is the exponent, and the second is the timestamp value.
      • Nanoseconds: The exponent is -9, and the timestamp value is in nanoseconds.
        Tag 1001({ 4: Tag 4([-9, timestamp_in_nanoseconds]) })
      • Microseconds: The exponent is -6, and the timestamp value is in microseconds.
        Tag 1001({ 4: Tag 4([-6, timestamp_in_microseconds]) })
      • Milliseconds: The exponent is -3, and the timestamp value is in milliseconds.
        Tag 1001({ 4: Tag 4([-3, timestamp_in_milliseconds]) })
    • Example:
      • Nanoseconds: 1001({ 4: 4([-9, 1704107471111587983]) })
      • Microseconds: 1001({ 4: 4([-6, 1704107471111587]) })
      • Milliseconds: 1001({ 4: 4([-3, 1704107471111]) })
  2. Key 1:
    • Value Format: These can denote significant values, such as -Infinity or +Infinity, to signify the minimum and maximum time points. Additionally, it supports epoch-based timestamp representation in seconds as an integer or floating-point value.
    • Structure:
      • Maximum time point: Tag 1001({ 1 : +Infinity })
      • Minimum time point: Tag 1001({ 1 : -Infinity })
      • Timestamp as integer: Tag 1001({ 1: timestamp_in_seconds_as_integer })
      • Timestamp as floating-point: Tag 1001({ 1: timestamp_in_seconds_as_floating_point })
    • Example:
      • Timestamp as integer: 1001({1: 1704107471 })
      • Timestamp as floating-point: 1001({1: 1704107471.111859 })

Timestamp with Tag 1

Timestamps can be encoded with CBOR Tag 1, which denotes an Epoch-Based Date/Time format. This tag encapsulates a representation of time in seconds, which can be expressed either as an integer or a floating-point value.

  • Structure:
    • Timestamp as integer: Tag 1(seconds_as_integer)
    • Timestamp as floating-point: Tag 1(seconds_as_floating_point)
  • Examples:
    • Timestamp as integer: 1( 1704107471 )
    • Timestamp as floating-point: 1( 1704107471.111859 )

Server-to-Client Timestamp Format

The server transmits timestamps to the client with precision in nanoseconds using Tag 1001 for valid timestamps. For timestamps indicating the minimum and maximum time points, the server utilizes Tag 1001 with representations of +/- Infinity, as mentioned above.

Client-to-Server Timestamp Format

Clients have the flexibility to utilize any of the aforementioned formats to transmit timestamps to the server, accommodating various levels of precision as needed.

Format for Images

Image data (Data Type Identifier 23 "data type identifier" is not accessible via the Xentara Websocket interface. Image data is transmitted as a short UTF-8 string describing the size and format of the image.