Skip to content

Commit

Permalink
🩹 fix(core): gateway doesn't handle normal closing
Browse files Browse the repository at this point in the history
  • Loading branch information
Helloyunho committed May 18, 2024
1 parent b286d83 commit f139193
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/gateway/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,15 @@ export class Gateway extends EventEmitter<GatewayEvents> {
case GatewayCloseCode.AUTHENTICATION_FAILED:
this.emit("CLOSED", e.code, false, true);
break;
case GatewayCloseCode.NORMAL:
this.emit("CLOSED", e.code, false, false);
break;
default:
this.emit("CLOSED", e.code, this.retryCount < 5, !this.connectionError);
if (!this.reconnecting) {
if (this.retryCount < 5) {
setTimeout(() => {
const id = setTimeout(() => {
clearTimeout(id);
this.retryCount++;
this.reconnect(!this.connectionError);
}, 500);
Expand Down

0 comments on commit f139193

Please sign in to comment.