#1569·MQTT.js

连接 `ws://[::1]:8883` 时会抛出错误 - Uncaught TypeError TypeError [ERR_INVALID_URL]: URL 无效

作者: Steve-Mcl创建于 2023年1月16日更新于 2026年9月7日

Hi, I am getting an exception when connecting to IPv6 localhost address ::1

I have found this was reported and fixed in https://GitHub.com/mqttjs/MQTT.js/issues/1130/#1147 (commit https://GitHub.com/mqttjs/MQTT.js/commit/70a247c29e0b05ddd8755e7b9c8c41a4c25b431b) however it seems to have been reverted and the current V4.3.7 is once more using the depreciated url.parse as you can see here: https://GitHub.com/mqttjs/MQTT.js/blob/main/lib/connect/index.js#L64