[GH-ISSUE #1959] MQTT pathname is stripped from URL #629

Closed
opened 2026-03-16 16:26:22 +03:00 by kerem · 1 comment
Owner

Originally created by @xadh00m on GitHub (Nov 17, 2021).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1959

Originally assigned to: @liyasthomas on GitHub.

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:

  1. Go to 'Realtime/MQTT'
  2. Type wss://foo.bar.com:8883/broker/ws as URL
  3. 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@f28b55dd4d/packages/hoppscotch-app/components/realtime/Mqtt.vue (L247)

Maybe a fix could look like this?
parseUrl.hostname + parseUrl.pathname !== "/" ? parseUrl.pathname : ""

Thank you!

Originally created by @xadh00m on GitHub (Nov 17, 2021). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1959 Originally assigned to: @liyasthomas on GitHub. **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: 1. Go to 'Realtime/MQTT' 2. Type `wss://foo.bar.com:8883/broker/ws` as URL 3. 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: https://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!
kerem closed this issue 2026-03-16 16:26:37 +03:00
Author
Owner

@xadh00m commented on GitHub (Nov 17, 2021):

Thank you very much! :-)

<!-- gh-comment-id:971532088 --> @xadh00m commented on GitHub (Nov 17, 2021): Thank you very much! :-)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#629
No description provided.