Browse Source

Merge branch 'dev-zyj' of usky-cloud-paas/data-writer into master

James 1 year ago
parent
commit
869882c486
1 changed files with 3 additions and 1 deletions
  1. 3 1
      ytDataWriteProcess/mqttdatathread.cpp

+ 3 - 1
ytDataWriteProcess/mqttdatathread.cpp

@@ -32,7 +32,9 @@ void MqttDataThread::mqtt_conf(QString ip,QString port,QString username,QString
     m_client = new QMQTT::Client(QHostAddress(mqtt_ip),static_cast<quint16>(mqtt_port.toInt()),this);
     m_client->setUsername(mqtt_username);
     m_client->setPassword(mqtt_passwd.toLatin1());
-    m_client->setCleanSession(true);
+    m_client->setCleanSession(false);
+    m_client->setAutoReconnect(true);
+    m_client->setAutoReconnectInterval(60000);
     connect(m_client,&QMQTT::Client::connected,this,&MqttDataThread::onConnected);
     connect(m_client,&QMQTT::Client::received,this,&MqttDataThread::onReceived);
     m_client->connectToHost();