ConfigData

Stores the client configuration settings.

Constructor

new ConfigData()

Creates a new instance of the ConfigData class.
Pass the instance to the SmartFox#connect method when connecting the client to SmartFoxServer.

Classes

AudioCfg

Members

_netDebugLevel :number

Type:
  • number

audio :ConfigData.AudioCfg

Configuration settings for audio stream capture and playback.

host :string

IP address or host name of the SmartFoxServer instance to connect to.
Type:
  • string
Default Value
  • 127.0.0.1

netDebugLevel :number

The level of client-server debug messages that should be logged by the client, among those provided by the NetDebugLevel class.
Type:
  • number
Default Value

port :number

WebSocket port of the SmartFoxServer instance to connect to.
Type:
  • number
Default Value
  • 8088

useSSL :boolean

Instructs the API to use the WebSocket Secure (WSS) protocol instead of the default WebSocket (WS) protocol to protect all client-server communication.

If set to true, ConfigData#port value must be set to SmartFoxServer's WSS port too.

Type:
  • boolean
Default Value
  • false

zone :string

Zone of the SmartFoxServer instance to join during the login process.
Type:
  • string
Default Value
  • null

Methods

(async) load(url) → {Promise.<void>}

Loads and parses an external configuration file from a URL and overrides the default values of the ConfigData properties.

The configuration file must contain a "name=value" pair per line. Use dot notation for nested properties (i.e. audio.enableAEC=true). Lines starting with # are skipped.

Unknown properties and invalid values are logged as warnings and ignored. The value of properties accepting a constant (for example ConfigData.AudioCfg#monitoringMode) can be expressed either as the name of the constant (case-insensitive) or as its value: for example audio.monitoringMode=RMS or audio.monitoringMode=1.

Parameters:
NameTypeDescription
urlstring | URLThe URL of the configuration file, either absolute or relative to the current page URL (not to the calling script). To resolve it relative to the calling module instead, pass new URL('./config.txt', import.meta.url).
Returns:
A promise resolving when the configuration has been loaded and applied.
Type: 
Promise.<void>