From 5de610bc42eeb76dacd8a8f4feb2b1e157f15a0e Mon Sep 17 00:00:00 2001 From: Xiaoxin Lu Date: Tue, 22 Jun 2021 12:29:05 -0400 Subject: [PATCH] Fix websocket timer throttle blocking writes --- lib/transports/websocket.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/transports/websocket.js b/lib/transports/websocket.js index 7e5193e64..c9a82cb95 100644 --- a/lib/transports/websocket.js +++ b/lib/transports/websocket.js @@ -161,10 +161,10 @@ class WS extends Transport { if (lastPacket) { // fake drain // defer to next tick to allow Socket to clear writeBuffer - setTimeout(() => { + Promise.resolve().then(() => { this.writable = true; this.emit("drain"); - }, 0); + }); } }); }