# 下载服务器端
$ git clone https://github.com/Coolpy7/mqttsn-gateway.git && cd mqttsn-gateway
# data/mqttsn.yml配置文件
$ vim data/mqttsn.yml
# 使用聚合管道模式
IsAggregate: true
# 代理服务宿主ip
Host: 0.0.0.0
# 代理服务端口
Port: 1884
# Coolpy7 Broker所在ip
BrokerHost: "192.168.200.238"
# Coolpy7 Broker 端口
BrokerPort: 1883
# 登陆Coolpy7如开启身份验证需填以下两项
BrokerUser:
BrokerPassword:
# 日志文件名字
LogFilePath: mqttsn.log
# 消息队列最大值
MessageQueueSize: 1000
# 网络流限制
ReadBuffSize: 212992
WriteBuffSize: 212992
# 提权
chmod -R 777 go_build_Coolpy7_sngw_go_linux_linux
# 启动Coolpy7 mqtt-sn gateway
./go_build_Coolpy7_sngw_go_linux_linux
# 启动成功后大概会显示如下信息即启动成功
2018/12/01 11:36:10 aggregating_gw_impl.go:33: Connect to broker
2018/12/01 11:36:10 gateway.go:59: set read buff size : 212992
2018/12/01 11:36:10 gateway.go:65: set write buff size : 212992
此示例使用NodeMcu(Esp8266)作为Lora网关中转消息连接到Coolpy7 MQTT-SN Gateway代理服务,终端设备使用Lora(433)无线通信与网关通信后与Coolpy7实现通信链路