MQTT pathname is stripped from URL
Describe the bug
We have an MQTT broker reachable via Websocket at e.g. wss://foo.bar.com:8883/broker/ws
. If I use this URL the pathname /broker/ws
is stripped/ignored and Paho tries to connect to foo.bar.com:8883
.
To Reproduce
Steps to reproduce the behavior:
- Go to ‘Realtime/MQTT’
- Type
wss://foo.bar.com:8883/broker/ws
as URL - Check error message in console which shows the stripped URL without its pathname
Expected behavior
The pathname should not be stripped.
Desktop
- Browser: Firefox
- Version 94
Additional context
The issue is due to this line: github.com/hoppscotch/hoppscotch/blob/f28b55dd4d854653582fdef9edf2b32c2584782c/packages/hoppscotch-app/components/realtime/Mqtt.vue#L247
Maybe a fix could look like this?
parseUrl.hostname + parseUrl.pathname !== "/" ? parseUrl.pathname : ""
Thank you!
Read more here: Source link