From 5b7292af0960289dda62a378d6bef730e39f0c77 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 4 Jun 2020 22:55:52 +0300 Subject: [PATCH] Stream: Do not write before the connection is open --- src/StreamingClient.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/StreamingClient.ts b/src/StreamingClient.ts index 9b1e8c6..8605838 100644 --- a/src/StreamingClient.ts +++ b/src/StreamingClient.ts @@ -31,6 +31,7 @@ export class StreamingClient extends Writable { this.ws.on("message", this._onmessage.bind(this)) this.ws.on("error", this._onerror.bind(this)) this.ws.on("close", this._onclose.bind(this)) + this.cork() } /** @@ -39,6 +40,7 @@ export class StreamingClient extends Writable { private _onopen() { debugLog(`opened connection to aws transcribe`) this.emit(StreamingClient.EVENTS.OPEN) + this.uncork() } /**