Skip to content

Commit

Permalink
fix(WebSocketShard): account code 1000 with no prior indication
Browse files Browse the repository at this point in the history
  • Loading branch information
didinele committed Jul 30, 2022
1 parent fca3dad commit 89a0935
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

0 comments on commit 89a0935

Please sign in to comment.