|
@@ -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();
|