mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 05:23:31 +01:00
feat: @discordjs/ws (#8260)
Co-authored-by: Parbez <imranbarbhuiya.fsd@gmail.com>
This commit is contained in:
25
packages/ws/src/strategies/sharding/IShardingStrategy.ts
Normal file
25
packages/ws/src/strategies/sharding/IShardingStrategy.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { GatewaySendPayload } from 'discord-api-types/v10';
|
||||
import type { Awaitable } from '../../utils/utils';
|
||||
import type { WebSocketShardDestroyOptions } from '../../ws/WebSocketShard';
|
||||
|
||||
/**
|
||||
* Strategies responsible for spawning, initializing connections, destroying shards, and relaying events
|
||||
*/
|
||||
export interface IShardingStrategy {
|
||||
/**
|
||||
* Spawns all the shards
|
||||
*/
|
||||
spawn: (shardIds: number[]) => Awaitable<void>;
|
||||
/**
|
||||
* Initializes all the shards
|
||||
*/
|
||||
connect: () => Awaitable<void>;
|
||||
/**
|
||||
* Destroys all the shards
|
||||
*/
|
||||
destroy: (options?: Omit<WebSocketShardDestroyOptions, 'recover'>) => Awaitable<void>;
|
||||
/**
|
||||
* Sends a payload to a shard
|
||||
*/
|
||||
send: (shardId: number, payload: GatewaySendPayload) => Awaitable<void>;
|
||||
}
|
||||
Reference in New Issue
Block a user