feat: @discordjs/ws (#8260)

Co-authored-by: Parbez <imranbarbhuiya.fsd@gmail.com>
This commit is contained in:
DD
2022-07-22 20:13:47 +03:00
committed by GitHub
parent 830c670c61
commit 748d7271c4
37 changed files with 3659 additions and 2612 deletions

View 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>;
}