0
点赞
收藏
分享

微信扫一扫

windows搭建MQTT服务器

闲云困兽 2022-01-17 阅读 82

文章目录

一、下载mosquitto

点击下载安装程序 下载地址
在这里插入图片描述

二、配置mosquitto

  1. 安装路径打开命令行界面
    在这里插入图片描述

  2. 设置user及password

    执行:mosquitto_passwd.exe -c pwfile.example -u vic
    设置用户名:vic  	设置密码:123456
    

在这里插入图片描述

  1. 配置文件检查

     mosquitto.exe -c mosquitto.conf 
     未报错说明配置正常
    
  2. 设置端口

     默认端口:1883
     启动:mosquitto.exe
     指定端口启动:mosquitto.exe -p 10086
    
  3. 订阅者

     mosquitto_sub.exe -h 127.0.0.1 -p 10086 -t topicTest01 -u vic -P 123456
    
  4. 发布者

     mosquitto_pub.exe -h 127.0.0.1 -p 10086 -u admin -P 111 -t topicTest01 -m "hello world"
    
  5. 命令行测试
    在这里插入图片描述

三、MQTTX

  1. 连接服务器

在这里插入图片描述

  1. 订阅topic
    在这里插入图片描述
  2. 发布消息

在这里插入图片描述

举报

相关推荐

0 条评论