Interface: ITransport

ITransport

A Stormancer network transport.

Source:

Members

connectionClosed :Array.<function()>

Fires when a connection to a remote peer is closed.

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

connectionOpened :Array.<function()>

Fires when a remote peer has opened a connection.

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

id :number

Id of the local peer.

Type:
  • number
Source:

isRunning :boolean

Gets a boolean indicating if the transport is currently running.

Type:
  • boolean
Source:

name :string

The name of the transport.

Type:
  • string
Source:

packetReceived :Array.<function()>

Fires when the transport recieves new packets.

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

Methods

connect(endpoint) → {Promise.<Stormancer.IConnection>}

Connects the transport to a remote host.

Parameters:
Name Type Description
endpoint string

A string containing the target endpoint the expected format is host:port.

Source:
Returns:

A Task<IConnection> object completing with the connection process and returning the corresponding IConnection.

Type
Promise.<Stormancer.IConnection>

getComponent(name, handler, token) → {Promise}

Starts the transport.

Parameters:
Name Type Description
name string

The name of the transport if several are started.

handler Stormancer.IConnectionManager

The connection handler used by the connection.

token object

A CancellationToken. It will be cancelled when the transport has to be shutdown.

Source:
Returns:

A Task completing when the transport is started.

Type
Promise