eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.62k stars 2.33k forks source link

mosquitto_sub with -C and -W options #3009

Open gsaviane opened 4 months ago

gsaviane commented 4 months ago

Running the following command over a mosquitto 2.0.11 installation

mosquitto_sub -h host -p port -t topic -C 1 and -W 10

waits for the timeout to expire whether or not a message is read. Since the -C option says:

Disconnect and exit the program immediately after the given count of messages have been received. This may be useful in shell scripts where on a single status value is required, for example.

I would expect that the timeout takes place only when there are no messages in the topic, and it is ignored when a message is actually read, respecting the -C specs.

Daedaluz commented 4 months ago

can you try with a newer version? This works on 2.0.18, unless i misunderstood something.