From 139ddd80936aab5c1e4d51524140eec650ec1a26 Mon Sep 17 00:00:00 2001 From: Alexis Tyler Date: Mon, 22 Feb 2021 20:01:29 +1030 Subject: [PATCH] fix: socket not sending message when readyState is 2 or 3 --- app/mothership/custom-socket.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/mothership/custom-socket.ts b/app/mothership/custom-socket.ts index 507f63387..97a93e174 100644 --- a/app/mothership/custom-socket.ts +++ b/app/mothership/custom-socket.ts @@ -269,11 +269,11 @@ export class CustomSocket { return true; } - protected async sendMessage(clientName: string, message?: string, timeout = 1000) { + protected async sendMessage(clientName: 'relay' | 'internalGraphql', message?: string, timeout = 1000) { const client = sockets.get(clientName)?.connection; try { - if (!client || client.readyState === 0 || client.readyState === 2 || client.readyState === 3) { + if (!client || client.readyState === 0) { this.logger.silly('Waiting %ss to retry sending to %s.', timeout / 1000, client?.url); // Wait for $timeout seconds await sleep(timeout);