hivemq / mqtt-cli

MQTT CLI is a useful command line interface for connecting various MQTT clients supporting MQTT 5.0 and 3.1.1
https://hivemq.github.io/mqtt-cli/
Apache License 2.0
305 stars 47 forks source link

Unknown option: '--ws' #350

Closed flyisland closed 11 months ago

flyisland commented 1 year ago

Expected behavior

Connecting to "ws://localhost:8000"

Actual behavior

❯ mqtt pub -h "ws://localhost:8000" -t abc -m "hello mqtt" -r Unable to connect. Reason: 'ws://localhost:8000: nodename nor servname provided, or not known'

❯ mqtt pub -h "ws://localhost" -p 8000 -t abc -m "hello mqtt" -r Unable to connect. Reason: 'ws://localhost: nodename nor servname provided, or not known'

❯ mqtt pub -h "localhost" -p 8000 -t abc -m "hello mqtt" -r Unable to connect. Reason: 'Connection refused'

❯ mqtt pub -h "localhost" -p 8000 -t abc -m "hello mqtt" -r --ws Unknown option: '--ws' Try 'mqtt pub --help' for more information.

To Reproduce

Steps

See above steps please

Reproducer code

Details

LukasBrand commented 11 months ago

Hello @flyisland, thank your for using the MQTT-CLI!

Can you please try:

mqtt pub -h "localhost" -p 8000 -t abc -m "hello mqtt" -r -ws

If you want to add a WebSocket path to you can use -ws:path

Unfortunately the MQTT-CLI uses single dash multi letter options which is very unusual and far from ideal... I fixed the documentation to reflect the current state of the option as it showed the wrong--ws and there is already a ticket to improve on the naming conventions of some options.

flyisland commented 11 months ago

@LukasBrand, thanks, "-ws" works.