mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
feat(gateway): add stopGateway function (#2078)
* Move the shard stopping to gatewayManager in order to stop the gateway standalone. * Update gateway/gateway_manager.ts Co-authored-by: ITOH <to@itoh.at> * Update gateway/stopGateway.ts Co-authored-by: ITOH <to@itoh.at> * Update gateway/stopGateway.ts * Update gateway/stopGateway.ts * Update gateway/stopGateway.ts Co-authored-by: ITOH <to@itoh.at> Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
/** Use this function to stop the gateway properly */
|
||||
export async function stopGateway(gateway: GatewayManager, code = 3061, reason = "Discordeno Testing Finished! Do Not RESUME!") {
|
||||
|
||||
// STOP WS
|
||||
gateway.shards.forEach((shard) => {
|
||||
clearInterval(shard.heartbeat.intervalId);
|
||||
gateway.closeWS(
|
||||
shard.ws,
|
||||
code,
|
||||
|
||||
reason,
|
||||
);
|
||||
});
|
||||
|
||||
await delay(5000);
|
||||
}
|
||||
Reference in New Issue
Block a user