以下命令显示发布到与正则表达式匹配但不是确切主题本身的主题的所有消息.
mosquitto_sub -h localhost -u user -P pass -t 'devices/#'
{"value":"50"}
{"value":"45"}
Run Code Online (Sandbox Code Playgroud)
例如,上面的json消息发布到主题设备/ 1234/transducer/46364 /但是我无法使用mosquitto_sub打印主题.
har*_*llb 13
使用该-v选项
mosquitto_sub -h localhost -u user -P pass -v -t 'devices/#'
Run Code Online (Sandbox Code Playgroud)
从手册页:
-v, --verbose
Print received messages verbosely. With this argument, messages
will be printed as "topic payload". When this argument is not
given, the messages are printed as "payload".
Run Code Online (Sandbox Code Playgroud)