Home Reference Source
public class | source

Network

Network represent a network layer with three main components:

  • The network itself, which can be a RPS, like SprayAdapter, or an overlay, like LatenciesOverlay.
  • The signaling part, which is a connection with a signaling server used by peers to join the network.
  • The communication part, which allow a peer to send message in the network using broadcast or unicast channels.

Constructor Summary

Public Constructor
public

constructor(network: AbstractNetwork, signaling: Object, protocol: string)

Constructor

Member Summary

Public Members
public get

The communication component

public get

The network component

public get

protocol: [type]: *

Get the protocol of the network

public get

The signaling component

Private Members
private
private
private
private

Method Summary

Public Methods
public

use(middleware: Object, priority: Number): void

Register a middleware, with an optional priority

Public Constructors

public constructor(network: AbstractNetwork, signaling: Object, protocol: string) source

Constructor

Params:

NameTypeAttributeDescription
network AbstractNetwork

The network layer

signaling Object

Options used to build the signaling part

signaling.address string

URL of the signaling server

signaling.room string

Name of the room in which the application run

protocol string

Name of the protocol run by the network

Public Members

public get communication: Communication: * source

The communication component

Return:

Communication

The communication component

public get network: AbstractNetwork: * source

The network component

Return:

AbstractNetwork

The network component

public get protocol: [type]: * source

Get the protocol of the network

Return:

[type]

[description]

public get signaling: Signaling: * source

The signaling component

Return:

Signaling

The signaling component

Private Members

private _communication: * source

private _network: * source

private _protocol: * source

private _signaling: * source

Public Methods

public use(middleware: Object, priority: Number): void source

Register a middleware, with an optional priority

Params:

NameTypeAttributeDescription
middleware Object

The middleware to register

middleware.in function

Function applied on middleware input

middleware.out function

Function applied on middleware output

priority Number
  • optional
  • default: 0

(optional) The middleware priority

Return:

void