Interface: IConnection

IConnection

A connection to a remote peer.

Source:

Members

account :string

Account of the application which the peer is connected to.

Type:
  • string
Source:

application :string

Name of the application to which the peer is connected.

Type:
  • string
Source:

ConnectionClosed :Array.<function()>

Event fired when the connection has been closed.

Type:
  • Array.<function()>
Source:

connectionDate :date

Connection date.

Type:
  • date
Source:

id :string

Unique id in the node for the connection.

Type:
  • string
Source:

metadata :metadata

Metadata associated with the connection.

Type:
  • metadata
Source:

ping :number

The connection's Ping in milliseconds.

Type:
  • number
Source:

state :Stormancer.ConnectionState

State of the connection.

Type:
Source:

Methods

close()

Close the connection.

Source:

getComponent(componentName) → {object}

Gets a service from the object.

Parameters:
Name Type Description
componentName string

Type of the service to fetch.

Source:
Returns:

The requested component.

Type
object

registerComponent(component)

Register components.

Parameters:
Name Type Description
component object

The component to register.

Source:

sendSystem(msgId, data, priority)

Sends a system message to the peer. (System reserved)

Parameters:
Name Type Description
msgId number

Message ID.

data Uint8Array

The data to send.

priority Stormancer.PacketPriority

Priority of the message.

Source:

sendToScene(sceneIndex, route, data, priority, reliability)

Sends a packet to the target remote scene. (System reserved)

Parameters:
Name Type Description
sceneIndex number

Scene index.

route number

Route index.

data Uint8Array

Data to send.

priority Stormancer.PacketPriority

Priority of the message.

reliability Stormancer.PacketReliability

Reliability of the message.

Source:

setApplication(account, application)

Sets the account and application associated with this object. Used only serverside.

Parameters:
Name Type Description
account string

The account ID.

application string

The application name.

Source: