From da20fe874554fcf3ec786176fd890dd721c9e9f4 Mon Sep 17 00:00:00 2001 From: yuhj <315913876@qq.com> Date: Tue, 18 May 2021 02:48:55 +0800 Subject: [PATCH] fixed: custom parser is broken --- lib/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 1d4eb33..f6fc659 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -134,9 +134,9 @@ export class Adapter extends EventEmitter { packet.nsp = this.nsp.name; const encodedPackets = this.encoder.encode(packet); - + const isString = typeof encodedPackets[0] == "string"; const firstPacketOpts = { - wsPreEncoded: "4" + encodedPackets[0], // "4" being the "message" packet type in Engine.IO + wsPreEncoded: isString ? "4" + encodedPackets[0] : encodedPackets[0], // "4" being the "message" packet type in Engine.IO ...packetOpts };