diff --git a/packages/ws/src/ws/WebSocketShard.ts b/packages/ws/src/ws/WebSocketShard.ts index f7cf67080..11e6ebba2 100644 --- a/packages/ws/src/ws/WebSocketShard.ts +++ b/packages/ws/src/ws/WebSocketShard.ts @@ -224,8 +224,7 @@ export class WebSocketShard extends AsyncEventEmitter { // Prevent a reconnection loop by unbinding the main close event this.connection.removeAllListeners('close'); - const shouldClose = - this.connection.readyState === WebSocket.OPEN || this.connection.readyState === WebSocket.CONNECTING; + const shouldClose = this.connection.readyState === WebSocket.OPEN; this.debug([ 'Connection status during destroy', @@ -301,7 +300,7 @@ export class WebSocketShard extends AsyncEventEmitter { // If the error is handled, we can just try to reconnect await this.destroy({ code: CloseCodes.Normal, - reason: 'Something timed out', + reason: 'Something timed out or went wrong while waiting for an event', recover: WebSocketShardDestroyRecovery.Reconnect, });