Home Manual Reference Source Repository
import FullyConnectedService from 'netflux/src/service/topology/FullyConnectedService.js'
public class | source

FullyConnectedService

Extends:

* → FullyConnectedService

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 WebChannel.

public

broadcast(webChannel: WebChannel, data: ArrayBuffer)

Send message to all WebChannel members.

public

leave(wc: *)

public

onChannel(channel: *): *

public

onChannelClose(closeEvt: CloseEvent, channel: Channel): boolean

Close event handler for each Channel in the WebChannel.

public

onChannelError(evt: Event, channel: Channel)

Error event handler for each Channel in the WebChannel.

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:

NameTypeAttributeDescription
channel WebSocket | RTCDataChannel

Return:

Promise<number, string>

public broadcast(webChannel: WebChannel, data: ArrayBuffer) source

Send message to all WebChannel members.

Params:

NameTypeAttributeDescription
webChannel WebChannel
data ArrayBuffer

public leave(wc: *) source

Params:

NameTypeAttributeDescription
wc *

public onChannel(channel: *): * source

Params:

NameTypeAttributeDescription
channel *

Return:

*

public onChannelClose(closeEvt: CloseEvent, channel: Channel): boolean source

Close event handler for each Channel in the WebChannel.

Params:

NameTypeAttributeDescription
closeEvt CloseEvent
channel Channel

Return:

boolean

public onChannelError(evt: Event, channel: Channel) source

Error event handler for each Channel in the WebChannel.

Params:

NameTypeAttributeDescription
evt Event
channel Channel

public onMessage(channel: *, senderId: *, recepientId: *, msg: *) source

Params:

NameTypeAttributeDescription
channel *
senderId *
recepientId *
msg *

public sendInner(wc: *, data: *) source

Params:

NameTypeAttributeDescription
wc *
data *

public sendInnerTo(recepient: *, wc: *, data: *) source

Params:

NameTypeAttributeDescription
recepient *
wc *
data *

public sendTo(id: *, webChannel: *, data: *) source

Params:

NameTypeAttributeDescription
id *
webChannel *
data *