From b3c1b54d7b01779f7b3984a959c7b5903c0070df Mon Sep 17 00:00:00 2001 From: Santhosh Vaiyapuri Date: Fri, 20 Sep 2024 13:50:30 +0200 Subject: [PATCH] remove the previous timeout --- packages/client/src/StreamSfuClient.ts | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/packages/client/src/StreamSfuClient.ts b/packages/client/src/StreamSfuClient.ts index ecea5df80a..9a2d1fafb5 100644 --- a/packages/client/src/StreamSfuClient.ts +++ b/packages/client/src/StreamSfuClient.ts @@ -464,6 +464,7 @@ export class StreamSfuClient { * @param timeout an optional timeout in milliseconds for sending the message. */ private send = async (message: SfuRequest, timeout: number = 0) => { + // wait for the signal ws to be open if (timeout > 0) { await Promise.race([ this.signalReady, @@ -472,28 +473,14 @@ export class StreamSfuClient { }), ]); } else { - await this.signalReady; // wait for the signal ws to be open + await this.signalReady; } const msgJson = SfuRequest.toJson(message); if (this.signalWs.readyState !== WebSocket.OPEN) { this.logger('debug', 'Signal WS is not open. Skipping message', msgJson); return; } - return new Promise((resolve, reject) => { - const timeoutId = - timeout > 0 - ? setTimeout(() => reject(new Error('Timeout sending msg')), timeout) - : undefined; - try { - this.logger('debug', `Sending message to: ${this.edgeName}`, msgJson); - this.signalWs.send(SfuRequest.toBinary(message)); - resolve(); - } catch (err) { - reject(err); - } finally { - clearTimeout(timeoutId); - } - }); + this.signalWs.send(SfuRequest.toBinary(message)); }; private keepAlive = () => {