WebSocketManagerOptions

export interface WebSocketManagerOptions extends OptionalWebSocketManagerOptions, RequiredWebSocketManagerOptions
export interface WebSocketManagerOptions extends OptionalWebSocketManagerOptions, RequiredWebSocketManagerOptions

No summary provided.

compression:CompressionMethod | null
The transport compression method to use - mutually exclusive with useIdentifyCompression
Default value
null (no transport compression)
Inherited from OptionalWebSocketManagerOptions
encoding:Encoding
The encoding to use
Default value
'json'
Inherited from OptionalWebSocketManagerOptions
handshakeTimeout:number | null
How long to wait for a shard to connect before giving up
Inherited from OptionalWebSocketManagerOptions
helloTimeout:number | null
How long to wait for a shard's HELLO packet before giving up
Inherited from OptionalWebSocketManagerOptions
identifyProperties:GatewayIdentifyProperties
Properties to send to the gateway when identifying
Inherited from OptionalWebSocketManagerOptions
Initial presence data to send to the gateway when identifying
Inherited from OptionalWebSocketManagerOptions
intents:GatewayIntentBits | 0
The intents to request
Inherited from RequiredWebSocketManagerOptions
largeThreshold:number | null
Value between 50 and 250, total number of members where the gateway will stop sending offline members in the guild member list
Inherited from OptionalWebSocketManagerOptions
readyTimeout:number | null
How long to wait for a shard's READY packet before giving up
Inherited from OptionalWebSocketManagerOptions
rest:REST
The REST instance to use for fetching gateway information
Inherited from RequiredWebSocketManagerOptions
shardCount:number | null
The total number of shards across all WebsocketManagers you intend to instantiate. Use null to use Discord's recommended shard count
Inherited from OptionalWebSocketManagerOptions
shardIds:number[] | ShardRange | null
The ids of the shards this WebSocketManager should manage. Use null to simply spawn 0 through shardCount - 1
Example
const manager = new WebSocketManager({
shardIds: [1, 3, 7], // spawns shard 1, 3, and 7, nothing else
});
const manager = new WebSocketManager({
shardIds: [1, 3, 7], // spawns shard 1, 3, and 7, nothing else
});
Example
const manager = new WebSocketManager({
shardIds: {
start: 3,
end: 6,
}, // spawns shards 3, 4, 5, and 6
});
const manager = new WebSocketManager({
shardIds: {
start: 3,
end: 6,
}, // spawns shards 3, 4, 5, and 6
});
Inherited from OptionalWebSocketManagerOptions
token:string
The token to use for identifying with the gatewayIf not provided, the token must be set using setToken
Inherited from OptionalWebSocketManagerOptions
useIdentifyCompression:boolean
Whether to use the compress option when identifying
Default value
false
Inherited from OptionalWebSocketManagerOptions
version:string
The gateway version to use
Default value
'10'
Inherited from OptionalWebSocketManagerOptions
buildIdentifyThrottler(manager):Awaitable<IIdentifyThrottler>
Builds an identify throttler to use for this manager's shards
NameTypeOptionalDescription
managerWebSocketManagerNoNone
Inherited from OptionalWebSocketManagerOptions
buildStrategy(manager):IShardingStrategy
Builds the strategy to use for sharding
Example
const manager = new WebSocketManager({
token: process.env.DISCORD_TOKEN,
intents: 0, // for no intents
rest,
buildStrategy: (manager) => new WorkerShardingStrategy(manager, { shardsPerWorker: 2 }),
});
const manager = new WebSocketManager({
token: process.env.DISCORD_TOKEN,
intents: 0, // for no intents
rest,
buildStrategy: (manager) => new WorkerShardingStrategy(manager, { shardsPerWorker: 2 }),
});
NameTypeOptionalDescription
managerWebSocketManagerNoNone
Inherited from OptionalWebSocketManagerOptions
retrieveSessionInfo(shardId):Awaitable<SessionInfo | null>
Function used to retrieve session information (and attempt to resume) for a given shard
Example
const manager = new WebSocketManager({
async retrieveSessionInfo(shardId): Awaitable<SessionInfo | null> {
// Fetch this info from redis or similar
return { sessionId: string, sequence: number };
// Return null if no information is found
},
});
const manager = new WebSocketManager({
async retrieveSessionInfo(shardId): Awaitable<SessionInfo | null> {
// Fetch this info from redis or similar
return { sessionId: string, sequence: number };
// Return null if no information is found
},
});
NameTypeOptionalDescription
shardIdnumberNoNone
Inherited from OptionalWebSocketManagerOptions
updateSessionInfo(shardId, sessionInfo):Awaitable<void>
Function used to store session information for a given shard
NameTypeOptionalDescription
shardIdnumberNoNone
sessionInfoSessionInfo | nullNoNone
Inherited from OptionalWebSocketManagerOptions