Class: Packet

Packet

A packet sent by a remote peer to the running peer.

Constructor

new Packet()

A packet sent by a remote peer to the running peer.

Source:

Members

connection :Object

A byte representing the index of the scene for this peer.

Type:
  • Object
Source:

data :Uint8Array

Data contained in the packet.

Type:
  • Uint8Array
Source:

Methods

getDataView() → {DataView}

Get a DataView on the internal data buffer

Source:
Returns:
Type
DataView

getMetadata() → {Object.<string, Object>}

Get the metadatas from the packet.

Source:
Returns:
Type
Object.<string, Object>

getMetadataValue(key) → {string}

Returns metadata

Parameters:
Name Type Description
key string
Source:
Returns:

Key associated object

Type
string

readObject() → {Object}

Deserialize the internal data to an object by using MsgPack and return this object.

Source:
Returns:
Type
Object

setMetadata(metadata)

Set the metadatas of the packet. This action will overwrite the existing metadatas.

Parameters:
Name Type Description
metadata Object
Source:

setMetadataValue(key, value)

Set a metadata in the packet

Parameters:
Name Type Description
key string
value Object
Source: