Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
SAL
【rt-thread网络连载】第1篇:使用mosquitto搭建mqtt broker
发布于 2023-04-04 21:29:30 浏览:664
订阅该版
@[toc] # 一、mosquitto搭建 ## 1.1 mosquitto介绍 mosquitto下载地址:https://mosquitto.org/download/ Eclipse Mosquitto是一个开源(EPL/EDL许可)消息代理(broker),它实现了MQTT协议版本5.0、3.1.1和3.1。Mosquito重量轻,适用于从低功耗单板计算机到完整服务器的所有设备。 ## 1.2 使用mosquitto在windows下创建一个mqtt broker ### step1)使能mosquitto服务 ![screenshot_image.png](https://oss-club.rt-thread.org/uploads/20230404/3e8080104df9652ae7fc3cbea413b5db.png) ### step2)配置mosquitto ```c # MQTT协议端口号 listener 1883 # 启用WebSocket支持 listener 9001 protocol websockets # 订阅主题持久化 persistence true persistence_location D:\software\mosquitto\data # 开启日志记录 log_dest file D:\software\mosquitto\mosquitto.log log_type all # 开启密码验证 password_file D:\software\mosquitto\pwfile.example allow_anonymous false ``` ### step3)创建访问mqtt broker的账户 mosquitto_passwd.exe用于生成连接mqtt broker的用户名和密码,下面的命令表示向pwfile.example文件追加一个“myAccount”账户,在client中可以用这个账户和密码登录,否则会报验证失败的错误。 ```c .\mosquitto_passwd.exe .\pwfile.example myAccount ``` ### step4)启动mqtt broker 执行下面的命令可以启动一个mqtt服务器 ```c .\mosquitto.exe -v -c .\config\mosquitto.conf ``` # 二、mqtt网络包分析 ![screenshot_image.png](https://oss-club.rt-thread.org/uploads/20230404/af01602347aeaf7bf80c24af868e1f4d.png) # 三、参考 [Windows环境下安装配置Mosquitto服务及入门操作介绍](https://www.cnblogs.com/zkwarrior/p/10972464.html) [Windows 操作系统安装Mosquitto (MQTT)及测试](https://blog.csdn.net/xhm0924/article/details/109151357)
0
条评论
默认排序
按发布时间排序
登录
注册新账号
关于作者
happycode999
这家伙很懒,什么也没写!
文章
28
回答
6
被采纳
0
关注TA
发私信
相关文章
1
SAL 不支持 PF_PACKET,如何修改可以支持?
2
socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
3
SAL组件好像并不支持DTLS
4
添加SAL组件后socket相关函数均提示declared implicitly
5
sal组件socket等函数无法使用
6
SAL关闭自带的一个socket连接
7
wiznet与libmodbus软件包衔接对接SAL层传参问题
8
sal验证link.rt-thread.org:8101失败
9
请问 AT-SAL,recv() 函数在服务端断开之后没有返回,是设计如此吗?
10
多网卡的出现创建socket失败
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
DMA
USB
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
I2C_IIC
ESP8266
UART
WIZnet_W5500
ota在线升级
cubemx
PWM
flash
freemodbus
BSP
packages_软件包
潘多拉开发板_Pandora
定时器
ADC
flashDB
GD32
socket
编译报错
中断
Debug
rt_mq_消息队列_msg_queue
keil_MDK
SFUD
msh
ulog
C++_cpp
MicroPython
本月问答贡献
三世执戟
5
个答案
1
次被采纳
KunYi
4
个答案
1
次被采纳
RTT_逍遥
3
个答案
1
次被采纳
xiaorui
1
个答案
1
次被采纳
JonasWen
1
个答案
1
次被采纳
本月文章贡献
出出啊
1
篇文章
3
次点赞
小小李sunny
1
篇文章
1
次点赞
张世争
1
篇文章
3
次点赞
crystal266
2
篇文章
2
次点赞
whj467467222
2
篇文章
2
次点赞
回到
顶部
发布
问题
投诉
建议
回到
底部