Constructor
new TopicConnector(properties)
Parameters:
Name | Type | Description |
---|---|---|
properties |
- |
- Source:
Example
import FileConnector from 'core/protocol/TopicConnector.js';
let protocol = new TopicConnector(<topic_name>);
// connect
protocol.connect();
// disconnect
protocol.disconnect();
// close
protocol.close();
Extends
Methods
checkStatus(status)
Check a change of the status and call the corresponding callbacks if necessary
Parameters:
Name | Type | Description |
---|---|---|
status |
Status | the currentStatus |
- Overrides:
- Source:
close()
Closes the webSocket.
- Source:
connect()
Connect to the broadcastChannel.
- Source:
disconnect()
Disconnects the websocket.
- Source:
fullDisconnect(removeInterval)
Fully disconnect the websocket connection by sending a close message to the webWorker.
Parameters:
Name | Type | Description |
---|---|---|
removeInterval |
Boolean | force removing the interval |
- Source:
getId() → {String}
The data protocol default id.
- Overrides:
- Source:
Returns:
- Type
- String
getUrl() → {String}
The stream url.
- Overrides:
- Source:
Returns:
- Type
- String
onChangeStatus(status)
Called when the connection STATUS changes
Parameters:
Name | Type | Description |
---|---|---|
status |
Status | the new status |
- Overrides:
- Source:
onConnect()
Called when the protocol has been connected
- Overrides:
- Source:
onDisconnect()
Called when the protocol has been disconnected
- Overrides:
- Source:
reconnect()
Try to reconnect if the connexion if closed
- Source:
setReconnectTimeout(timeout)
Sets the reconnection timeout
Parameters:
Name | Type | Description |
---|---|---|
timeout |
Number | delay in milliseconds before reconnecting dataSource |
- Overrides:
- Source:
setUrl(url)
Sets the url
Parameters:
Name | Type | Description |
---|---|---|
url |
- Overrides:
- Source:
Events
onMessage
The onMessage method used by the websocket to callback the data
Parameters:
Name | Type | Description |
---|---|---|
data |
the callback data |
- Source: