From 62ac53534ef3864a78bd49d2d54623dc74e8060e Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 4 Jun 2020 22:56:18 +0300 Subject: [PATCH] Stream: Pass the callback to ws.send instead of calling it synchronously --- src/StreamingClient.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/StreamingClient.ts b/src/StreamingClient.ts index 9b1e8c6..30e707e 100644 --- a/src/StreamingClient.ts +++ b/src/StreamingClient.ts @@ -103,8 +103,7 @@ export class StreamingClient extends Writable { _write(chunk: any, _: string, cb: any) { const binary = toBinary(chunk) - this.ws.readyState === 1 && this.ws.send(binary) - cb() + this.ws.readyState === 1 && this.ws.send(binary, cb) } /**