You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用mosquitto_pub设置MQTT LWT消息报错:未知--will-message选项

解决mosquitto_pub指定遗嘱消息时的"Unknown option '--will-message'"错误

问题出在你用了错误的命令行选项:--will-message 并不是mosquitto_pub工具的合法选项,对应的正确选项是 --will-payload。

早期版本的mosquitto命令行工具中,用于指定遗嘱消息内容的参数是--will-payload,而非--will-message。

修正后的命令如下:

mosquitto_pub -h localhost -t "home/alerts" -m "Client disconnected unexpectedly" -q 1 --will-topic "home/alerts" --will-payload "Client disconnected unexpectedly" --will-qos 1

如果不确定工具支持的选项,可随时执行以下命令查看完整帮助:

mosquitto_pub --help

内容的提问来源于stack exchange,提问作者Javad-M

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 13:54:50