Connection
It maintains a WebSocket/SSE connection:
Supported methods
connect
Connects to the Event Delivery Service. This method can be used to reconnect after a disconnection, such as after using the disconnect
method:
connection.connect();
getConfig
Retrieves the configuration of the connection. Returns a Config
instance:
connection.getConfig();
Argument | Type | Description |
---|---|---|
return | Config | Client configuration of the connection |
getId
Retrieves the connection ID:
connection.getId();
Argument | Type | Description |
---|---|---|
return | number | ID of the connection |
getStatus
Checks status of the connection:
connection.getStatus();
The method can return the next ConnectionType
enum values:
Type | Description |
---|---|
ConnectionType.Closed | Connection closed |
ConnectionType.Connecting | Connection is opening |
ConnectionType.Open | Connection opened |
ConnectionType.Closing | Connection is closing |
getProperty
Get property of a connection:
connection.getProperty(name);
Argument | Type | Description |
---|---|---|
name | string | Name of a property |
return | string | Value of a property |
getProperties
Get all properties of a connection:
connection.getProperties();
Argument | Type | Description |
---|---|---|
return | object | Object of all property:value pairs |
querySet
Create a QuerySet
instance:
connection.querySet();
Argument | Type | Description |
---|---|---|
return | QuerySet | Query set instance |
disconnect
Disconnect from the Event Delivery Service:
connection.disconnect();
Argument | Type | Description |
---|---|---|
return | boolean | true if disconnected; false if it was not connected |