- npm install 下载依赖
- cd src
- node mqttServer.js 开启命令行窗口。开启服务端
- node mqttClient.js 开启另一个命令行窗口。开启客户端
- mqtt服务的连接需要说明来源是浏览器还是客户端
- 修改mqtt服务的配置在mqttServer.js里修改
- 使用客户端访问mqtt服务时使用options配置
- 使用浏览器访问mqtt服务时使用settings配置
- protoData的js为以protobuf的形式进行交互
- protobuf交互参考链接
dreamonthego / node-mqtt-demo Goto Github PK
View Code? Open in Web Editor NEWThis project forked from wayofwade/node-mqtt-demo
用node写的基于websocket的mqtt协议的demo,node启动mqtt服务端。支持node客户端访问以及浏览器访问。添加了protobuf传输的例子