From a4bd6029916e26a48b3f1acbbf9d741775e34baa Mon Sep 17 00:00:00 2001 From: Denis Badurina Date: Tue, 19 Jan 2021 20:02:27 +0100 Subject: [PATCH] fix(client): Wait for server acknowledgement indefinitely Closes: #98 --- src/client.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/client.ts b/src/client.ts index 65260c88..c464068e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -360,10 +360,6 @@ export function createClient(options: ClientOptions): Client { let cancelled = false; cancellerRef.current = () => (cancelled = true); - const tooLong = setTimeout(() => { - socket.close(3408, 'Waited 5 seconds but socket connect never settled'); - }, 5 * 1000); - /** * `onerror` handler is unnecessary because even if an error occurs, the `onclose` handler will be called * @@ -375,7 +371,6 @@ export function createClient(options: ClientOptions): Client { socket.onclose = (event) => { socket.onclose = null; - clearTimeout(tooLong); state = { ...state, acknowledged: false, socket: null }; emitter.emit('closed', event); return reject(event); @@ -394,7 +389,6 @@ export function createClient(options: ClientOptions): Client { throw new Error(`First message cannot be of type ${message.type}`); } - clearTimeout(tooLong); state = { ...state, acknowledged: true,