ubuntu mosquitto

环境

Ubuntu21

安装

sudo apt-get install mosquitto

## 客户端
sudo apt-get install mosquitto-clients

启动服务

mosquitto -c /etc/mosquitto/mosquitto.conf -d

发布订阅

参数讲解

参数 意义
-h 服务器主机,默认localhost
-t 指定主题
-u 用户名
-P 密码
-i 客户端id,唯一
-m 发布的消息内容
## 订阅
mosquitto_sub -h localhost -t "test" -i "client1"

## 发布
mosquitto_pub -h localhost -t "test" -i "client2" -m "Hello World!"
posted @   奔跑的兔  阅读(122)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 使用C#创建一个MCP客户端
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示