Extends
- EventEmitter
Members
(readonly) client :Client
The client that instantiated this WebSocketManager
Type:
(private) destroyed :boolean
If this manager was destroyed. It will prevent shards from reconnecting
Type:
- boolean
(nullable) gateway :string
The gateway this manager uses
Type:
- string
(private) packetQueue :Array.<object>
An array of queued events before this WebSocketManager became ready
Type:
- Array.<object>
(readonly) ping :number
The average ping of all WebSocketShards
Type:
- number
(private) reconnecting :boolean
If this manager is currently reconnecting one or multiple shards
Type:
- boolean
(private, nullable) sessionStartLimit :Object
The current session limit of the client
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
total |
number | Total number of identifies available |
remaining |
number | Number of identifies remaining |
reset_after |
number | Number of milliseconds after which the limit resets |
(private) shardQueue :Set.<WebSocketShard>
An array of shards to be connected or that need to reconnect
Type:
- Set.<WebSocketShard>
shards :Collection.<number, WebSocketShard>
A collection of all shards this manager handles
Type:
- Collection.<number, WebSocketShard>
status :number
The current status of this WebSocketManager
Type:
- number
(private) totalShards :number
The amount of shards this manager handles
Type:
- number
Methods
(private) _handleSessionLimit(remainingopt, resetAfteropt)
Handles the timeout required if we cannot identify anymore.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
remaining |
number |
<optional> |
The amount of remaining identify sessions that can be done today |
resetAfter |
number |
<optional> |
The amount of time in which the identify counter resets |
(private) broadcast(packet)
Broadcasts a packet to every shard this manager handles.
Parameters:
Name | Type | Description |
---|---|---|
packet |
Object | The packet to send |
(private) checkShardsReady()
Checks whether the client is ready to be marked as ready.
(private) connect()
Connects this manager to the gateway.
(private) createShards() → {Promise.<boolean>}
Handles the creation of a shard.
Returns:
- Type
- Promise.<boolean>
(private) debug(message, shardopt, nullable)
Emits a debug message.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | The debug message | |
shard |
WebSocketShard |
<optional> <nullable> |
The shard that emitted this message, if any |
(private) destroy()
Destroys this manager and all its shards.
(private) handlePacket(packetopt, shardopt) → {boolean}
Processes a packet and queues it if this WebSocketManager is not ready.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
packet |
Object |
<optional> |
The packet to be handled |
shard |
WebSocketShard |
<optional> |
The shard that will handle this packet |
Returns:
- Type
- boolean
(private) reconnect(skipLimitopt) → {Promise.<boolean>}
Handles reconnects for this manager.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
skipLimit |
boolean |
<optional> |
false | IF this reconnect should skip checking the session limit |
Returns:
- Type
- Promise.<boolean>
(private) triggerClientReady()
Causes the client to be marked as ready and emits the ready event.