new ReliableConnection(config) → {ReliableConnection}
Connection Class.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object | Connection Configuration. Properties
|
Returns:
- Type
- ReliableConnection
Members
(static) defaults
Default configuration parameters.
Properties:
Name | Type | Description |
---|---|---|
attempts |
number | |
delays |
Array.<number> |
(static) status :string
Connection status enum.
Type:
- string
Properties:
Name | Type | Description |
---|---|---|
idle |
Means the class is in the state of doing nothing. It is acquired in the following cases:
|
|
connected |
The connection just has been established.
|
|
disconnected |
Method
|
|
connecting |
Trying to connect.
|
|
failed |
Permanent failure, after the maximum number of attempts has been reached. |
|
stopped |
Method |
|
error |
Another connection attempt has failed.
|
Methods
disconnect()
Notifies the driver of the lost connection, to trigger reconnection attempts.
start()
Initiates connection attempts.
It is to be called after creating the class, or after calling stop()
.
The method does nothing, if the current status is either connected
or connecting
.
stop()
Notifies the driver of ceasing all connectivity at once, and to reset itself to the initial state.
The connection either already has been closed, or to be closed on status = stopped
.