Xentara WebSocket API Specification v2.0.3
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 of 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('B4E1C552E3C7406B95A2AA09C553F277')

Format for Time Stamps

In the Xentara WebSocket packets, time stamps 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.

Time Stamp with Tag 1001

Time stamps 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 time stamp.

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 time stamp value.
      • Nanoseconds: The exponent is -9, and the time stamp value is in nanoseconds.
        Tag 1001({ 4: Tag 4([-9, timestamp_in_nanoseconds]) })
      • Microseconds: The exponent is -6, and the time stamp value is in microseconds.
        Tag 1001({ 4: Tag 4([-6, timestamp_in_microseconds]) })
      • Milliseconds: The exponent is -3, and the time stamp 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 support epoch-based time stamp 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 })
      • Time stamp as integer: Tag 1001({ 1: timestamp_in_seconds_as_integer })
      • Time stamp as floating-point: Tag 1001({ 1: timestamp_in_seconds_as_floating_point })
    • Example:
      • Time stamp as integer: 1001({1: 1704107471 })
      • Time stamp as floating-point: 1001({1: 1704107471.111859 })

Time Stamp with Tag 1

Time stamps 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:
    • Time stamp as integer: Tag 1(seconds_as_integer)
    • Time stamp as floating-point: Tag 1(seconds_as_floating_point)
  • Examples:
    • Time stamp as integer: 1( 1704107471 )
    • Time stamp as floating-point: 1( 1704107471.111859 )

Server-to-Client Time Stamp Format

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

Client-to-Server Time Stamp Format

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