From 596b99a99a47fb33e214247568c34494ad27e0f6 Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Sat, 2 Jul 2022 21:05:08 +0700 Subject: [PATCH] Task: Updated the library for client tunnel and removed logs from write chunk and check on callback and chunks data that recieve and send --- lib.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib.js b/lib.js index 0e84ee8..366d8dd 100644 --- a/lib.js +++ b/lib.js @@ -7,14 +7,14 @@ class TunnelRequest extends stream.Readable { this._requestId = requestId; const onRequestPipe = (requestId, data) => { - console.log("Res pipe size", data.length) + console.log("Res pipe size", data.length); if (this._requestId === requestId) { this.push(data); } }; const onRequestPipes = (requestId, data) => { - console.log("Res pipes size", data.length) + // console.log("Res pipes size", data.length) if (this._requestId === requestId) { data.forEach((chunk) => { this.push(chunk); @@ -108,14 +108,16 @@ class TunnelResponse extends stream.Duplex { } _write(chunk, encoding, callback) { - console.log("Res Write Chunk: ", chunk.length); + console.log("Res Write Chunk: ", chunk.length, encoding); this._socket.emit("response-pipe", this._responseId, chunk); this._socket.io.engine.once("drain", () => { + console.log("hello = ", "callback...") callback(); }); } _writev(chunks, callback) { + console.log("Res Write Chunks: ", chunks.length); this._socket.emit("response-pipes", this._responseId, chunks); this._socket.io.engine.once("drain", () => { callback();