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

BotServer

BotServer can listen on web socket. A peer can invite bot to join his WebChannel. He can also join one of the bot's WebChannel.

Constructor Summary

Public Constructor
public

constructor(options: Object)

Bot server settings are the same as for WebChannel (see WebChannelSettings), plus host and port parameters.

Member Summary

Public Members
public
public
public

Method Summary

Public Methods
public

Add WebChannel.

public

Get WebChannel identified by its id.

public

Remove WebChannel

public

Starts listen on socket.

public

stop()

Stops listen on web socket.

Public Constructors

public constructor(options: Object) source

Bot server settings are the same as for WebChannel (see WebChannelSettings), plus host and port parameters.

Params:

NameTypeAttributeDescription
options Object
options.connector WEB_RTC | WEB_SOCKET
  • optional
  • default: WEB_SOCKET

Which connector is preferable during connection establishment

options.topology FULLY_CONNECTED
  • optional
  • default: FULLY_CONNECTED

Fully connected topology is the only one available for now

options.signalingURL string
  • optional
  • default: 'wss://sigver-coastteam.rhcloud.com:8443'

Signaling server url

options.iceServers RTCIceServer
  • optional
  • default: [{urls:'stun:turn01.uswest.xirsys.com'}]

Set of ice servers for WebRTC

options.host string
  • optional
  • default: 'localhost'
options.port number
  • optional
  • default: 9000

Public Members

public onWebChannel: function(wc: WebChannel) source

public server: WebSocketServer source

public webChannels: WebChannel[] source

Public Methods

public addWebChannel(wc: WebChannel) source

Add WebChannel.

Params:

NameTypeAttributeDescription
wc WebChannel

public getWebChannel(id: number): WebChannel | null source

Get WebChannel identified by its id.

Params:

NameTypeAttributeDescription
id number

Return:

WebChannel | null

public removeWebChannel(wc: WebChannel) source

Remove WebChannel

Params:

NameTypeAttributeDescription
wc WebChannel

public start(): Promise<undefined, string> source

Starts listen on socket.

public stop() source

Stops listen on web socket.