Optional compressionThe compression method to use
null (no compression)
Optional encodingThe encoding to use
'json'
Optional handshakeHow long to wait for a shard to connect before giving up
Optional helloHow long to wait for a shard's HELLO packet before giving up
Optional identifyProperties to send to the gateway when identifying
Optional initialInitial presence data to send to the gateway when identifying
The intents to request
Optional largeValue between 50 and 250, total number of members where the gateway will stop sending offline members in the guild member list
Optional readyHow long to wait for a shard's READY packet before giving up
The REST instance to use for fetching gateway information
Optional shardThe total number of shards across all WebsocketManagers you intend to instantiate.
Use null to use Discord's recommended shard count
Optional shardThe ids of the shards this WebSocketManager should manage.
Use null to simply spawn 0 through shardCount - 1
const manager = new WebSocketManager({
  shardIds: [1, 3, 7], // spawns shard 1, 3, and 7, nothing else
});
const manager = new WebSocketManager({
  shardIds: {
    start: 3,
    end: 6,
  }, // spawns shards 3, 4, 5, and 6
});
The token to use for identifying with the gateway
Optional versionThe gateway version to use
'10'
Optional buildBuilds an identify throttler to use for this manager's shards
Optional buildBuilds the strategy to use for sharding
const manager = new WebSocketManager({
 token: process.env.DISCORD_TOKEN,
 intents: 0, // for no intents
 rest,
 buildStrategy: (manager) => new WorkerShardingStrategy(manager, { shardsPerWorker: 2 }),
});
Optional retrieveFunction used to retrieve session information (and attempt to resume) for a given shard
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
  },
});
Optional updateFunction used to store session information for a given shard
Generated using TypeDoc
Required options for the WebSocketManager