黄学彪
2020-04-13 3793a9a38ac6c4c4111c2bba3a35a71c30601e82
ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
@@ -3130,14 +3130,14 @@
                            {
                                if (localMqttClient.Options == null)
                                {
                                    var options = new MQTTnet.Client.Options.MqttClientOptionsBuilder().WithClientId(currentGuid.ToString())
                       .WithTcpServer(brokerName, 1883)
                       .WithKeepAlivePeriod(TimeSpan.FromSeconds(20))
                       .WithCleanSession()
                        //.WithCommunicationTimeout(TimeSpan.FromSeconds(10))
                       .WithCredentials("", "")
                       .Build();
                                    await localMqttClient.ConnectAsync(options, CancellationToken.None);
                                    var options = new MQTTnet.Client.Options.MqttClientOptionsBuilder()//MQTT连接参数填充
                                    .WithClientId(currentGuid.ToString())//客户端ID
                                    .WithTcpServer(brokerName, 1883)//TCP服务端  1883  ,即MQTT服务端
                                    .WithCredentials("", "")//"", "")//凭证  帐号 密码
                                    .WithCommunicationTimeout(new TimeSpan(0, 0, 60)) //重连超时时间,默认5s
                                    .WithKeepAlivePeriod(new TimeSpan(0, 0, 15)) //保持连接时间,默认5s,心跳包
                                    .Build();//
                                    await localMqttClient.ConnectAsync(options);
                                }
                                else
                                {