new SC(config)
StreamCompanion constructor
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object
|
|
Members
Methods
addToken(token) → {Boolean}
Add/register token to the listener
Parameters:
| Name | Type | Description |
|---|---|---|
token |
string
|
Token key/name |
Returns:
- Type:
-
Boolean
getBackground() → {Promise.<object>}
Get map background image data
Returns:
- Type:
-
Promise.<object>
getData(nameopt) → {string|object}
Get name value from map data listener cache if exist. Returns all cached map data if no name is given
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name |
string
|
<optional> |
Map data key/name |
Returns:
- Type:
-
string|object
Data value string, entire data cache object or null if the data name doesn't exist
getJson() → {Promise.<object>}
Get JSON data of a map
Returns:
- Type:
-
Promise.<object>
getLiveData(nameopt) → {string|object}
Get name value from live listener cache if exist. Returns all cached live data if no name is given
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name |
string
|
<optional> |
Live data key/name |
Returns:
- Type:
-
string|object
Live data value string, entire live data cache object or null if the live data name doesn't exist
getOverlayList() → {Promise.<object>}
Get web overlay list
Returns:
- Type:
-
Promise.<object>
getSettings() → {Promise.<object>}
Get SC settings
Returns:
- Type:
-
Promise.<object>
getToken(tokenopt) → {string|object}
Get name value from token listener cache if exist. Returns all cached tokens if no name is given
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
token |
string
|
<optional> |
Token key/name |
Returns:
- Type:
-
string|object
Token value string, entire token cache object or null if the token doesn't exist
initialize()
Initialize/Start creating WebSocket clients
You need to run this if config.initializeAutomatically is false
removeToken(token) → {Boolean}
Remove/unregister token from the listener
Parameters:
| Name | Type | Description |
|---|---|---|
token |
string
|
Token key/name |
Returns:
- Type:
-
Boolean
Events
data
Emitted when data is received from any of the enabled websockets
Properties:
| Name | Type | Description |
|---|---|---|
type |
string
|
WebSocket type |
data |
any
|
Received data |
Type:
-
object
disconnect
Emitted when a websocket is disconnected from StreamCompanion
Type:
-
string
error
Emitted when an expected or unexpected error has occured
Properties:
| Name | Type | Description |
|---|---|---|
ws |
WebSocket
|
string
|
null
|
WebSocket |
error |
Error
|
TypeError
|
Error |
Type:
-
object