Skip to content

Commit

Permalink
fix(WebSocketShard): account code 1000 with no prior indication (#8399)
Browse files Browse the repository at this point in the history
  • Loading branch information
didinele committed Jul 30, 2022
1 parent fca3dad commit 5137bfc
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/ws/src/ws/WebSocketShard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,20 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {

private async onClose(code: number) {
switch (code) {
case 1000:
case 4200: {
case CloseCodes.Normal: {
this.debug([`Disconnected normally from code ${code}`]);
if (this.status === WebSocketShardStatus.Ready) {
return this.destroy({
code,
reason: 'Got disconnected by Discord',
recover: WebSocketShardDestroyRecovery.Reconnect,
});
}

break;
}

case CloseCodes.Resuming: {
this.debug([`Disconnected normally from code ${code}`]);
break;
}
Expand Down

1 comment on commit 5137bfc

@vercel
Copy link

@vercel vercel bot commented on 5137bfc Jul 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.