Skip to content

[Bug]: Broker URL path is dropped in connect(), connections fail #1873

@dmotz

Description

@dmotz

MQTTjs Version

5.6.0

Broker

Eclipse, Hive, MQTTHQ, EMQX

Environment

Browser

Description

A release after 5.3.5 strips paths from broker URLs.

For example, the /mqtt in these broker URLs is dropped and the socket connection is made to the root path /:
wss://mqtt.eclipseprojects.io/mqtt
wss://broker.emqx.io:8084/mqtt
wss://broker.hivemq.com:8884/mqtt
wss://public.mqtthq.com:8084/mqtt

These connections fail as the path is needed.

Minimal Reproduction

mqtt.connect(url) where url contains a path, e.g.:

wss://mqtt.eclipseprojects.io/mqtt
wss://broker.emqx.io:8084/mqtt
wss://broker.hivemq.com:8884/mqtt
wss://public.mqtthq.com:8084/mqtt

Debug logs

mqtt.esm.js:5 WebSocket connection to 'wss://mqtt.eclipseprojects.io/' failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions