Hcf Mqtt协议 通讯组件,封装基于MQTTnet的通讯实现
1. 通过nuget引用 Hcf.Mqtt.Client 程序集
> Install-Package HcfNS.Mqtt.Client
2. 在 appsettings.json 中添加如下配置节点
"Hcf": {
"MqttClient": {
"ClientId": "127.0.0.1",
"Server": "127.0.0.1",
"Port": 1883,
"UserName": "admin",
"Password": "password",
"Timeout": 30, //秒
"Interval": 10,
"Topics": []
}
}
按照如下配置方式使用:
1. 通过nuget引用 Hcf.Mqtt.Server 程序集
> Install-Package HcfNS.Mqtt.Server
2. 在 appsettings.json 中添加如下配置节点
"Hcf": {
"MqttServer": {
"Ip": "127.0.0.1",
"Port": 1883,
"Timeout": 30,//单位:秒
"UserName": "admin",
"Password": "passwod"
},
"Kestrel": {
"Port": 5000,
//"MaxRequestBufferSize": 33554432, //32M
}
}