Mqtt shell `con` command without flag -s does not show any data

I am new to hivemq CLI. Am trying to test the publishing data for a specific topic.

I am able to sucessfully subscribe to a topic as follows

mqtt> con -h mqtt.[spoiler]mindshiftapps[/spoiler].net -i machome
machome@mqtt.[spoiler]mindshiftapps[/spoiler].net> sub -t dand/ELM8420
machome@mqtt.[spoiler]mindshiftapps[/spoiler].net> sub -t dand/ELM8420 -s
[{"TS":"1651752316","ID":"3", "ST":"101","VR":[10351.942383,10344.453125,7.489193,0.000000,-502.421753,-501.947021,-0.474724,0.000000,0.998824,0.998825,0.997997,1.000000,10364.126953,10356.623047,7.504224,0.000000,0.000000,0.000000,0.000000,0.000000,213.602097,215.743637,209.553268,215.509369,16.042824,48.087612,0.040861,0.000000,50.051994,1117614.625000,1119006.875000,9.364523,-55022.246094,0.000000,0.000000,0.000000,0.000000,499.932220,8523.416992,0.000000,0.000000,49.036106]}]
^C
bash-3.2$ 

But when I remove the -s flag there is nothing. How do I subsscribe and save the data coming into a file?

Thanks

Hi @sanjmeh ,

If you use -s with mqtt sub command, your output goes to the standard output (terminal).
If you use mqtt sub command with --outputToFile <my-file-name> then the output goes to the .

Please check out MQTT CLI options for its different commands here: Subscribe - MQTT CLI

Have fun!
Dasha from HiveMQ team

1 Like