From ce5e0400d58772a755d563dbff29379cf96dc7a1 Mon Sep 17 00:00:00 2001 From: timzaak Date: Tue, 25 Jun 2024 15:30:29 +0800 Subject: [PATCH] fix issue: #1892 --- src/lib/connect/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/connect/index.ts b/src/lib/connect/index.ts index 41dc94e22..8b8ea3952 100644 --- a/src/lib/connect/index.ts +++ b/src/lib/connect/index.ts @@ -106,7 +106,7 @@ function connect( if (opts.unixSocket) { opts.protocol = opts.protocol.replace('+unix', '') as MqttProtocol - } else if (!opts.protocol?.startsWith('ws')) { + } else if (!opts.protocol?.startsWith('ws') && !opts.protocol?.startsWith('wx')) { // consider path only with ws protocol or unix socket // url.parse could return path (for example when url ends with a `/`) // that could break the connection. See https://github.com/mqttjs/MQTT.js/pull/1874