Task: Updated the library for client tunnel and removed logs from write chunk and check on callback and chunks data that recieve and send

This commit is contained in:
Sambo Chea 2022-07-02 21:05:08 +07:00
parent 34bb3bf730
commit 596b99a99a
Signed by: sombochea
GPG Key ID: 3C7CF22A05D95490

8
lib.js
View File

@ -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();