Home Manual Reference Source Repository
public interface | source

TopologyInterface

Extends:

service/Service~Service → TopologyInterface

It is responsible to preserve Web Channel structure intact (i.e. all peers have the same vision of the Web Channel). Among its duties are:

  • Add a new peer into Web Channel.
  • Remove a peer from Web Channel.
  • Send a broadcast message.
  • Send a message to a particular peer.

See:

Method Summary

Public Methods
public abstract

Adds a new peer into Web Channel.

public abstract

Send a message to all peers in Web Channel.

public

connectTo(wc: *, peerIds: *): *

public abstract

Leave Web Channel.

public abstract

sendTo(id: string, wc: WebChannel, data: string)

Send a message to a particular peer in Web Channel.

Public Methods

public abstract add(ch: Channel): Promise source

Adds a new peer into Web Channel.

Params:

NameTypeAttributeDescription
ch Channel

Channel to be added (it should has the webChannel property).

Return:

Promise

Resolved once the channel has been succesfully added, rejected otherwise.

public abstract broadcast(wc: WebChannel, data: string) source

Send a message to all peers in Web Channel.

Params:

NameTypeAttributeDescription
wc WebChannel

Web Channel where the message will be propagated.

data string

Data in stringified JSON format to be send.

public connectTo(wc: *, peerIds: *): * source

Params:

NameTypeAttributeDescription
wc *
peerIds *

Return:

*

public abstract leave(wc: WebChannel) source

Leave Web Channel.

Params:

NameTypeAttributeDescription
wc WebChannel

Web Channel to leave.

public abstract sendTo(id: string, wc: WebChannel, data: string) source

Send a message to a particular peer in Web Channel.

Params:

NameTypeAttributeDescription
id string

Peer id.

wc WebChannel

Web Channel where the message will be propagated.

data string

Data in stringified JSON format to be send.