import TopologyInterface from 'netflux/src/service/topology/TopologyInterface.js'
TopologyInterface
Extends:
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.
Method Summary
Public Methods | ||
public abstract |
Adds a new peer into Web Channel. |
|
public abstract |
broadcast(wc: WebChannel, data: string) Send a message to all peers in Web Channel. |
|
public |
connectTo(wc: *, peerIds: *): * |
|
public abstract |
leave(wc: WebChannel) 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:
Name | Type | Attribute | Description |
ch | Channel | Channel to be added (it should has
the |
public abstract broadcast(wc: WebChannel, data: string) source
Send a message to all peers in Web Channel.
Params:
Name | Type | Attribute | Description |
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:
Name | Type | Attribute | Description |
wc | * | ||
peerIds | * |
Return:
* |
public abstract leave(wc: WebChannel) source
Leave Web Channel.
Params:
Name | Type | Attribute | Description |
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:
Name | Type | Attribute | Description |
id | string | Peer id. |
|
wc | WebChannel | Web Channel where the message will be propagated. |
|
data | string | Data in stringified JSON format to be send. |