enable auto reconnect

pull/135/head
Michael Zanetti 2018-08-30 20:13:19 +02:00
parent 096a285212
commit 2f2787fb98
2 changed files with 3 additions and 3 deletions

View File

@ -96,12 +96,13 @@ void AWSConnector::doConnect()
m_client->setVersion(QMQTT::V3_1_1);
m_client->setKeepAlive(30*60);
m_client->setCleanSession(true);
m_client->setAutoReconnect(true);
m_client->connectToHost();
connect(m_client, &QMQTT::Client::connected, this, &AWSConnector::onConnected);
connect(m_client, &QMQTT::Client::disconnected, this, &AWSConnector::onDisconnected);
connect(m_client, &QMQTT::Client::error, this, [](const QMQTT::ClientError error){
qDebug() << "error" << error;
qCWarning(dcAWS()) << "An error happened in the MQTT transport" << error;
});
connect(m_client, &QMQTT::Client::subscribed, this, &AWSConnector::onSubscribed);

View File

@ -85,7 +85,6 @@ void CloudTransport::connectToCloud(const QString &token)
void CloudTransport::remoteConnectionStateChanged(RemoteProxyConnection::State state)
{
qCDebug(dcCloud) << "Remote connection state changed" << state;
RemoteProxyConnection *proxyConnection = qobject_cast<RemoteProxyConnection*>(sender());
ConnectionContext context = m_connections.value(proxyConnection);
@ -99,7 +98,7 @@ void CloudTransport::remoteConnectionStateChanged(RemoteProxyConnection::State s
emit clientDisconnected(context.clientId);
break;
default:
qCDebug(dcCloud()) << state;
qCDebug(dcCloud()) << "Remote connection state changed" << state;
break;
}
}