Class: DataContainer

DataContainer(data)

Data container for messages

Constructor

new DataContainer(data)

Creates an instance of this class from a byte array.
Parameters:
Name Type Default Description
data Uint8Array null The message's raw data as a byte array.
Source:

Members

commandID :number

Type:
  • number
Source:

data :Uint8Array

Property 'data' contains the (optional) data content of the message
Type:
  • Uint8Array
Source:

(readonly) dataAsObject :Object

The data part of this message as an object.
Type:
  • Object
Source:

(readonly) dataAsString :String

The data part of this message as a string. Doesn't catch exceptions which arise when calling Buffer.from().
Type:
  • String
Source:

param1 :number

Type:
  • number
Source:

param2 :number

Type:
  • number
Source:

param3 :number

Type:
  • number
Source:

Methods

fromByteArray(data)

Initializes this instance from a byte array.
Parameters:
Name Type Description
data Uint8Array The message's raw data as a byte array.
Source:

serialize() → {string}

Serializes a server message to JSON. The content of the "data" property is
Source:
Returns:
The message serialized to JSON
Type
string

toByteArray() → {Uint8Array}

Converts this instance to a byte array.
Source:
Returns:
A byte array representing this data container.
Type
Uint8Array