import FullyConnectedService from 'netflux/src/service/topology/FullyConnectedService.js'
FullyConnectedService
Extends:
Fully connected web channel manager. Implements fully connected topology network, when each peer is connected to each other.
Method Summary
Public Methods | ||
public |
Add a peer to the |
|
public |
broadcast(webChannel: WebChannel, data: ArrayBuffer) Send message to all |
|
public |
leave(wc: *) |
|
public |
onChannel(channel: *): * |
|
public |
onChannelClose(closeEvt: CloseEvent, channel: Channel): boolean Close event handler for each |
|
public |
onChannelError(evt: Event, channel: Channel) Error event handler for each |
|
public |
onMessage(channel: *, senderId: *, recepientId: *, msg: *) |
|
public |
sendInner(wc: *, data: *) |
|
public |
sendInnerTo(recepient: *, wc: *, data: *) |
|
public |
sendTo(id: *, webChannel: *, data: *) |
Public Methods
public add(channel: WebSocket | RTCDataChannel): Promise<number, string> source
Add a peer to the WebChannel
.
Params:
Name | Type | Attribute | Description |
channel | WebSocket | RTCDataChannel |
public broadcast(webChannel: WebChannel, data: ArrayBuffer) source
Send message to all WebChannel
members.
Params:
Name | Type | Attribute | Description |
webChannel | WebChannel | ||
data | ArrayBuffer |
public leave(wc: *) source
Params:
Name | Type | Attribute | Description |
wc | * |
public onChannelClose(closeEvt: CloseEvent, channel: Channel): boolean source
Close event handler for each Channel
in the WebChannel
.
Params:
Name | Type | Attribute | Description |
closeEvt | CloseEvent | ||
channel | Channel |
public onChannelError(evt: Event, channel: Channel) source
Error event handler for each Channel
in the WebChannel
.
public onMessage(channel: *, senderId: *, recepientId: *, msg: *) source
Params:
Name | Type | Attribute | Description |
channel | * | ||
senderId | * | ||
recepientId | * | ||
msg | * |
public sendInner(wc: *, data: *) source
Params:
Name | Type | Attribute | Description |
wc | * | ||
data | * |
public sendInnerTo(recepient: *, wc: *, data: *) source
Params:
Name | Type | Attribute | Description |
recepient | * | ||
wc | * | ||
data | * |
public sendTo(id: *, webChannel: *, data: *) source
Params:
Name | Type | Attribute | Description |
id | * | ||
webChannel | * | ||
data | * |