shamblett / mqtt_client

A server and browser based MQTT client for dart
Other
543 stars 175 forks source link

MQTT Disconnect and Reconnects at very short intervals #273

Closed Husnain-Asharf closed 3 years ago

Husnain-Asharf commented 3 years ago

Hi,

I am using mqtt client with mosquitto broker. I am facing an issue, client disconnect disgracefully and reconnect immediately, often 5 time in hour some time more than 5 times in hour, i am connecting to broker with unique id with persistent session. My internet is stable.

Disconnection and Reconnection

Screenshot 2021-04-27 230053

my connection code is as following:-

** Future _login() async { // With await, we are assured of getting a string back and not a // Future placeholder instance. client = MqttServerClient.withPort(Constants.serverUri,this.topicpart, Constants.port); // Turn on mqtt package's logging while in test. client.logging(on: true); /// Set auto reconnect client.autoReconnect = true;

/// If you do not want active confirmed subscriptions to be automatically re subscribed
/// by the auto connect sequence do the following, otherwise leave this defaulted.

client.resubscribeOnAutoReconnect = false;

/// Add an auto reconnect callback.
/// This is the 'pre' auto re connect callback, called before the sequence starts.
client.onAutoReconnect = onAutoReconnect;

/// Add an auto reconnect callback.
/// This is the 'post' auto re connect callback, called after the sequence
/// has completed. Note that re subscriptions may be occurring when this callback
/// is invoked. See [resubscribeOnAutoReconnect] above.

client.onAutoReconnected = onAutoReconnected;

/// Add the unsolicited disconnection callback
client.onDisconnected = _onDisconnected;

/// Add the successful connection callback
client.onConnected = _onConnected;

/// Add a subscribed callback, there is also an unsubscribed callback if you need it.
/// You can add these before connection or change them dynamically after connection if
/// you wish. There is also an onSubscribeFail callback for failed subscriptions, these
/// can fail either because you have tried to subscribe to an invalid topic or the broker
/// rejects the subscribe request.
client.onSubscribed = _onSubscribed;
client.onSubscribeFail=_onUnSubscribed;
client.pongCallback = pong;
var lwt = {};
lwt["tid"]=this.topicpart;
lwt["type"]="lwt";
lwt["value"]="0";
final MqttConnectMessage connMess = MqttConnectMessage()
    .authenticateAs(Constants.user,Constants.password)
    .withClientIdentifier(this.topicpart)
    .keepAliveFor(60) // Must agree with the keep alive set above or not set
    .withWillTopic('flutter_test/'+topicpart+'/lwt') // If you set this you must set a will message
    .withWillMessage(jsonEncode(lwt))
    //.startClean() // Non persistent session for testing
    .withWillQos(MqttQos.atLeastOnce);
   // .withWillRetain();
print('client connecting....');
client.connectionMessage = connMess;

/// Connect the client, any errors here are communicated by raising of the appropriate exception. Note
/// in some circumstances the broker will just disconnect us, see the spec about this, we however eill
/// never send malformed messages.
try {
  await client.connect(Constants.user,Constants.password);
} on Exception catch (e) {
  print('EXCEPTION::client exception - $e');
  await MqttUtilities.asyncSleep(5);
  if(client!=null)
  client.disconnect();
  client = null;
  return client;
}

/// Check we are connected
if (client.connectionStatus.state == MqttConnectionState.connected) {
  print('client connected');
} else {
  /// Use status here rather than state if you also want the broker return code.
  print(
      'client connection failed - disconnecting, status is ${client.connectionStatus}');
  await MqttUtilities.asyncSleep(5);
  if(client!=null)
  client.disconnect();
  client = null;
}
return client;

}**

shamblett commented 3 years ago

You are using autoreconnect so the behavior you are seeing is expected, the client will reconnect on any disconnect.

You say your internet is stable, that may be so but your network connection to the broker doesn't seem to be, note that stable for browsing is not the same as stable enough to be connected to a broker permanently. I my experience wifi is usually a problem here.

Your unique id with persistent session has no bearing on network issues.

I'd need a full log output of a disconnect/reconnect sequence, its possible your broker is telling you why you are being disconnected.

Husnain-Asharf commented 3 years ago

You need client logs or broker logs?

shamblett commented 3 years ago

Client logs definitely, broker logs would be good if possible.

Husnain-Asharf commented 3 years ago

how can i store mqtt client logs in local db or storage is there any option in this package ?

shamblett commented 3 years ago

Logging just outputs to the console, if you want to store the logs just re direct your std out to wherever you want it.

Husnain-Asharf commented 3 years ago

You have any plan to enhance package to store package logs in local storage. It will help to test production app through these stored logs.

shamblett commented 3 years ago

No, no one has ever asked for this. If you wish to submit a pull request for this I'll gladly look at it. Bear in mind the client runs in both server and browser environments so you will need to find a solution for both.

Husnain-Asharf commented 3 years ago

These are logs from client and broker. It seems broker making disconnect after keepalive interval if you are not publishing anything. when i keep publishing data this is not happening. I tried with 60s, 30s, and 20s keepalive interval but all results are same.

Client Logs

I/flutter ( 9767): 1-2021-05-03 16:06:41.238707 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 9767): 1-2021-05-03 16:06:41.259386 -- MqttConnectionHandlerBase::autoReconnect entered I/flutter ( 9767): EXAMPLE::onAutoReconnect client callback - Client auto reconnection sequence will start I/flutter ( 9767): 1-2021-05-03 16:06:41.264296 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection I/flutter ( 9767): 1-2021-05-03 16:06:41.265717 -- MqttConnectionHandlerBase::connect - server broker.xs4arabia.com, port 1883 I/flutter ( 9767): 1-2021-05-03 16:06:41.266162 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter ( 9767): 1-2021-05-03 16:06:41.266405 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true I/flutter ( 9767): 1-2021-05-03 16:06:41.266603 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto I/flutter ( 9767): 1-2021-05-03 16:06:41.269588 -- MqttNormalConnection::connectAuto - entered I/flutter ( 9767): 1-2021-05-03 16:06:41.520751 -- MqttServerConnection::_startListening I/flutter ( 9767): 1-2021-05-03 16:06:41.522378 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 9767): 1-2021-05-03 16:06:41.522725 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 9767): 1-2021-05-03 16:06:41.523110 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 9767): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 103 I/flutter ( 9767): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=false, WillFlag=true, WillQos=MqttQos.atLeastOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=20 I/flutter ( 9767): MqttConnectPayload - client identifier is : 1004 I/flutter ( 9767): 1-2021-05-03 16:06:41.527366 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 9767): 1-2021-05-03 16:06:41.670759 -- MqttConnection::_onData I/flutter ( 9767): 1-2021-05-03 16:06:41.672473 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 9767): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 9767): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 9767): 1-2021-05-03 16:06:41.673454 -- MqttServerConnection::_onData - message available event fired I/flutter ( 9767): 1-2021-05-03 16:06:41.674221 -- MqttConnectionHandlerBase::_connectAckProcessor I/flutter ( 9767): 1-2021-05-03 16:06:41.674570 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected I/flutter ( 9767): MQTTClientWrapper::OnConnected client callback - Client connection was sucessful I/flutter ( 9767): Subscribing to the topic flutter_test/1004/orders I/flutter ( 9767): MQTTClientWrapper::Publishing message online to topic flutter_test/1001/status I/flutter ( 9767): 1-2021-05-03 16:06:41.676907 -- PublishingManager::publish - entered with topic flutter_test/1004/status I/flutter ( 9767): 1-2021-05-03 16:06:41.677572 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.publish I/flutter ( 9767): Header: MessageType = MqttMessageType.publish, Duplicate = false, Retain = false, Qos = MqttQos.atLeastOnce, Size = 0 I/flutter ( 9767): Publish Variable Header: TopicName={flutter_test/1004/status}, MessageIdentifier={8}, VH Length={0} I/flutter ( 9767): Payload: {42 bytes={<123><34><116><105><100><34><58><34><49><48><48><52><34><44><34><116><121><112><101><34><58><34><115><116><97><116><117><115><34><44><34><118><97><108><117><101><34><58><34><49><34><125> I/flutter ( 9767): 1-2021-05-03 16:06:41.679907 -- MqttConnectionHandlerBase:: cancelling connect timer I/flutter ( 9767): 1-2021-05-03 16:06:41.681081 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 9767): 1-2021-05-03 16:06:41.681405 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 9767): 1-2021-05-03 16:06:41.683568 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete I/flutter ( 9767): EXAMPLE::onAutoReconnected client callback - Client auto reconnection sequence has completed I/flutter ( 9767): 1-2021-05-03 16:06:41.688435 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false I/flutter ( 9767): 1-2021-05-03 16:06:41.821330 -- MqttConnection::_onData I/flutter ( 9767): 1-2021-05-03 16:06:41.823118 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.publishAck I/flutter ( 9767): Header: MessageType = MqttMessageType.publishAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 9767): PublishAck Variable Header: MessageIdentifier={8} I/flutter ( 9767): 1-2021-05-03 16:06:41.824384 -- MqttServerConnection::_onData - message available event fired I/flutter ( 9767): 1-2021-05-03 16:06:41.825284 -- MqttConnectionHandlerBase::messageAvailable - message type is MqttMessageType.publishAck I/flutter ( 9767): 1-2021-05-03 16:06:41.825817 -- PublishingManager::handlePublishAcknowledgement for message id 8 I/flutter ( 9767): 1-2021-05-03 16:06:58.648442 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter ( 9767): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter ( 9767): 1-2021-05-03 16:06:59.008695 -- MqttConnection::_onData I/flutter ( 9767): 1-2021-05-03 16:06:59.012432 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.pingResponse I/flutter ( 9767): Header: MessageType = MqttMessageType.pingResponse, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter ( 9767): 1-2021-05-03 16:06:59.015088 -- MqttServerConnection::_onData - message available event fired I/flutter ( 9767): 1-2021-05-03 16:06:59.016274 -- MqttConnectionHandlerBase::messageAvailable - message type is MqttMessageType.pingResponse I/flutter ( 9767): EXAMPLE::Ping response client callback invoked - you may want to disconnect your broker here I/flutter ( 9767): 1-2021-05-03 16:07:32.308561 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 9767): 1-2021-05-03 16:07:32.314371 -- MqttConnectionHandlerBase::autoReconnect entered I/flutter ( 9767): EXAMPLE::onAutoReconnect client callback - Client auto reconnection sequence will start I/flutter ( 9767): 1-2021-05-03 16:07:32.316663 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection I/flutter ( 9767): 1-2021-05-03 16:07:32.317113 -- MqttConnectionHandlerBase::connect - server broker.xs4arabia.com, port 1883 I/flutter ( 9767): 1-2021-05-03 16:07:32.317360 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter ( 9767): 1-2021-05-03 16:07:32.317671 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true I/flutter ( 9767): 1-2021-05-03 16:07:32.317903 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto I/flutter ( 9767): 1-2021-05-03 16:07:32.318126 -- MqttNormalConnection::connectAuto - entered I/flutter ( 9767): 1-2021-05-03 16:07:32.600548 -- MqttServerConnection::_startListening I/flutter ( 9767): 1-2021-05-03 16:07:32.602689 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 9767): 1-2021-05-03 16:07:32.603251 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 9767): 1-2021-05-03 16:07:32.603828 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 9767): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 103 I/flutter ( 9767): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=false, WillFlag=true, WillQos=MqttQos.atLeastOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=20 I/flutter ( 9767): MqttConnectPayload - client identifier is : 1004 I/flutter ( 9767): 1-2021-05-03 16:07:32.610125 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 9767): 1-2021-05-03 16:07:32.753336 -- MqttConnection::_onData I/flutter ( 9767): 1-2021-05-03 16:07:32.757070 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 9767): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 9767): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 9767): 1-2021-05-03 16:07:32.757991 -- MqttServerConnection::_onData - message available event fired I/flutter ( 9767): 1-2021-05-03 16:07:32.758641 -- MqttConnectionHandlerBase::_connectAckProcessor I/flutter ( 9767): 1-2021-05-03 16:07:32.760181 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected I/flutter ( 9767): MQTTClientWrapper::OnConnected client callback - Client connection was sucessful I/flutter ( 9767): Subscribing to the topic flutter_test/1004/orders I/flutter ( 9767): MQTTClientWrapper::Publishing message online to topic flutter_test/1001/status I/flutter ( 9767): 1-2021-05-03 16:07:32.764560 -- PublishingManager::publish - entered with topic flutter_test/1004/status I/flutter ( 9767): 1-2021-05-03 16:07:32.765499 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.publish I/flutter ( 9767): Header: MessageType = MqttMessageType.publish, Duplicate = false, Retain = false, Qos = MqttQos.atLeastOnce, Size = 0 I/flutter ( 9767): Publish Variable Header: TopicName={flutter_test/1004/status}, MessageIdentifier={9}, VH Length={0} I/flutter ( 9767): Payload: {42 bytes={<123><34><116><105><100><34><58><34><49><48><48><52><34><44><34><116><121><112><101><34><58><34><115><116><97><116><117><115><34><44><34><118><97><108><117><101><34><58><34><49><34><125> I/flutter ( 9767): 1-2021-05-03 16:07:32.768746 -- MqttConnectionHandlerBase:: cancelling connect timer I/flutter ( 9767): 1-2021-05-03 16:07:32.770131 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 9767): 1-2021-05-03 16:07:32.770553 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 9767): 1-2021-05-03 16:07:32.771231 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete I/flutter ( 9767): EXAMPLE::onAutoReconnected client callback - Client auto reconnection sequence has completed I/flutter ( 9767): 1-2021-05-03 16:07:32.772023 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false I/flutter ( 9767): 1-2021-05-03 16:07:32.907151 -- MqttConnection::_onData I/flutter ( 9767): 1-2021-05-03 16:07:32.909511 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.publishAck I/flutter ( 9767): Header: MessageType = MqttMessageType.publishAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 9767): PublishAck Variable Header: MessageIdentifier={9} I/flutter ( 9767): 1-2021-05-03 16:07:32.910711 -- MqttServerConnection::_onData - message available event fired I/flutter ( 9767): 1-2021-05-03 16:07:32.911771 -- MqttConnectionHandlerBase::messageAvailable - message type is MqttMessageType.publishAck I/flutter ( 9767): 1-2021-05-03 16:07:32.912356 -- PublishingManager::handlePublishAcknowledgement for message id 9 I/flutter ( 9767): 1-2021-05-03 16:07:58.656649 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter ( 9767): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter ( 9767): 1-2021-05-03 16:07:58.787609 -- MqttConnection::_onData I/flutter ( 9767): 1-2021-05-03 16:07:58.789596 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.pingResponse I/flutter ( 9767): Header: MessageType = MqttMessageType.pingResponse, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter ( 9767): 1-2021-05-03 16:07:58.790756 -- MqttServerConnection::_onData - message available event fired I/flutter ( 9767): 1-2021-05-03 16:07:58.791951 -- MqttConnectionHandlerBase::messageAvailable - message type is MqttMessageType.pingResponse I/flutter ( 9767): EXAMPLE::Ping response client callback invoked - you may want to disconnect your broker here I/flutter ( 9767): 1-2021-05-03 16:08:31.804537 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 9767): 1-2021-05-03 16:08:31.807017 -- MqttConnectionHandlerBase::autoReconnect entered I/flutter ( 9767): EXAMPLE::onAutoReconnect client callback - Client auto reconnection sequence will start I/flutter ( 9767): 1-2021-05-03 16:08:31.807778 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection I/flutter ( 9767): 1-2021-05-03 16:08:31.808143 -- MqttConnectionHandlerBase::connect - server broker.xs4arabia.com, port 1883 I/flutter ( 9767): 1-2021-05-03 16:08:31.808378 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter ( 9767): 1-2021-05-03 16:08:31.808550 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true I/flutter ( 9767): 1-2021-05-03 16:08:31.808745 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto I/flutter ( 9767): 1-2021-05-03 16:08:31.809084 -- MqttNormalConnection::connectAuto - entered I/flutter ( 9767): 1-2021-05-03 16:08:32.065980 -- MqttServerConnection::_startListening I/flutter ( 9767): 1-2021-05-03 16:08:32.067384 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 9767): 1-2021-05-03 16:08:32.067754 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 9767): 1-2021-05-03 16:08:32.067985 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 9767): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 103 I/flutter ( 9767): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=false, WillFlag=true, WillQos=MqttQos.atLeastOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=20 I/flutter ( 9767): MqttConnectPayload - client identifier is : 1004 I/flutter ( 9767): 1-2021-05-03 16:08:32.071021 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 9767): 1-2021-05-03 16:08:32.204461 -- MqttConnection::_onData I/flutter ( 9767): 1-2021-05-03 16:08:32.212874 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 9767): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 9767): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 9767): 1-2021-05-03 16:08:32.214209 -- MqttServerConnection::_onData - message available event fired I/flutter ( 9767): 1-2021-05-03 16:08:32.215001 -- MqttConnectionHandlerBase::_connectAckProcessor I/flutter ( 9767): 1-2021-05-03 16:08:32.215314 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected I/flutter ( 9767): MQTTClientWrapper::OnConnected client callback - Client connection was sucessful I/flutter ( 9767): Subscribing to the topic flutter_test/1004/orders I/flutter ( 9767): MQTTClientWrapper::Publishing message online to topic flutter_test/1001/status I/flutter ( 9767): 1-2021-05-03 16:08:32.217472 -- PublishingManager::publish - entered with topic flutter_test/1004/status I/flutter ( 9767): 1-2021-05-03 16:08:32.218178 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.publish I/flutter ( 9767): Header: MessageType = MqttMessageType.publish, Duplicate = false, Retain = false, Qos = MqttQos.atLeastOnce, Size = 0 I/flutter ( 9767): Publish Variable Header: TopicName={flutter_test/1004/status}, MessageIdentifier={10}, VH Length={0} I/flutter ( 9767): Payload: {42 bytes={<123><34><116><105><100><34><58><34><49><48><48><52><34><44><34><116><121><112><101><34><58><34><115><116><97><116><117><115><34><44><34><118><97><108><117><101><34><58><34><49><34><125> I/flutter ( 9767): 1-2021-05-03 16:08:32.222232 -- MqttConnectionHandlerBase:: cancelling connect timer I/flutter ( 9767): 1-2021-05-03 16:08:32.223792 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 9767): 1-2021-05-03 16:08:32.224248 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 9767): 1-2021-05-03 16:08:32.224950 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete I/flutter ( 9767): EXAMPLE::onAutoReconnected client callback - Client auto reconnection sequence has completed I/flutter ( 9767): 1-2021-05-03 16:08:32.225621 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false I/flutter ( 9767): 1-2021-05-03 16:08:32.356664 -- MqttConnection::_onData I/flutter ( 9767): 1-2021-05-03 16:08:32.357131 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.publishAck I/flutter ( 9767): Header: MessageType = MqttMessageType.publishAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 9767): PublishAck Variable Header: MessageIdentifier={10} I/flutter ( 9767): 1-2021-05-03 16:08:32.357455 -- MqttServerConnection::_onData - message available event fired I/flutter ( 9767): 1-2021-05-03 16:08:32.357675 -- MqttConnectionHandlerBase::messageAvailable - message type is MqttMessageType.publishAck I/flutter ( 9767): 1-2021-05-03 16:08:32.357794 -- PublishingManager::handlePublishAcknowledgement for message id 10

Broker logs

2021-05-03T14:56:48: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T14:56:50: New connection from 62.209.14.113:48278 on port 1883. 2021-05-03T14:56:50: New client connected from 62.209.14.113:48278 as 1004 (p1, c0, k30, u'oreem'). 2021-05-03T14:58:00: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T14:58:01: New connection from 62.209.14.113:48330 on port 1883. 2021-05-03T14:58:01: New client connected from 62.209.14.113:48330 as 1004 (p1, c0, k30, u'oreem'). 2021-05-03T14:59:00: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T14:59:02: New connection from 62.209.14.113:48340 on port 1883. 2021-05-03T14:59:02: New client connected from 62.209.14.113:48340 as 1004 (p1, c0, k30, u'oreem'). 2021-05-03T15:00:12: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:00:12: New connection from 62.209.14.113:48418 on port 1883. 2021-05-03T15:00:12: New client connected from 62.209.14.113:48418 as 1004 (p1, c0, k30, u'oreem'). 2021-05-03T15:02:30: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:02:32: New connection from 62.209.14.113:48466 on port 1883. 2021-05-03T15:02:32: New client connected from 62.209.14.113:48466 as 1004 (p1, c0, k30, u'oreem'). 2021-05-03T15:03:18: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:03:19: New connection from 62.209.14.113:48468 on port 1883. 2021-05-03T15:03:19: New client connected from 62.209.14.113:48468 as 1004 (p1, c0, k30, u'oreem'). 2021-05-03T15:04:36: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:04:36: New connection from 62.209.14.113:48480 on port 1883. 2021-05-03T15:04:36: New client connected from 62.209.14.113:48480 as 1004 (p1, c0, k30, u'oreem'). 2021-05-03T15:05:43: Client 1004 closed its connection. 2021-05-03T15:05:58: New connection from 62.209.14.113:48510 on port 1883. 2021-05-03T15:05:58: New client connected from 62.209.14.113:48510 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:06:36: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:06:40: New connection from 62.209.14.113:48978 on port 1883. 2021-05-03T15:06:40: New client connected from 62.209.14.113:48978 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:07:30: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:07:31: New connection from 62.209.14.113:48562 on port 1883. 2021-05-03T15:07:31: New client connected from 62.209.14.113:48562 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:08:30: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:08:30: New connection from 62.209.14.113:48582 on port 1883. 2021-05-03T15:08:30: New client connected from 62.209.14.113:48582 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:09:30: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:09:30: New connection from 62.209.14.113:48584 on port 1883. 2021-05-03T15:09:30: New client connected from 62.209.14.113:48584 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:10:06: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:10:06: New connection from 62.209.14.113:48638 on port 1883. 2021-05-03T15:10:06: New client connected from 62.209.14.113:48638 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:10:48: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:10:48: New connection from 62.209.14.113:48652 on port 1883. 2021-05-03T15:10:48: New client connected from 62.209.14.113:48652 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:11:42: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:11:43: New connection from 62.209.14.113:48662 on port 1883. 2021-05-03T15:11:43: New client connected from 62.209.14.113:48662 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:12:24: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:12:24: New connection from 62.209.14.113:48732 on port 1883. 2021-05-03T15:12:24: New client connected from 62.209.14.113:48732 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:13:00: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:13:01: New connection from 62.209.14.113:48734 on port 1883. 2021-05-03T15:13:01: New client connected from 62.209.14.113:48734 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:14:00: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:14:01: New connection from 62.209.14.113:48744 on port 1883. 2021-05-03T15:14:01: New client connected from 62.209.14.113:48744 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:14:36: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:14:37: New connection from 62.209.14.113:48754 on port 1883. 2021-05-03T15:14:37: New client connected from 62.209.14.113:48754 as 1004 (p1, c0, k20, u'oreem'). 2021-05-03T15:15:12: Client 1004 has exceeded timeout, disconnecting. 2021-05-03T15:15:13: New connection from 62.209.14.113:48758 on port 1883. 2021-05-03T15:15:13: New client connected from 62.209.14.113:48758 as 1004 (p1, c0, k20, u'oreem').

shamblett commented 3 years ago

Going from the top of the log where Keepalive is set to 20 seconds in the connect message.

I/flutter ( 9767): 1-2021-05-03 16:06:41.674570 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected I/flutter ( 9767): MQTTClientWrapper::OnConnected client callback - Client connection was sucessful

broker - 2021-05-03T15:06:40: New connection from 62.209.14.113:48978 on port 1883. broker - 2021-05-03T15:06:40: New client connected from 62.209.14.113:48978 as 1004 (p1, c0, k20, u'oreem').

All OK so far, we now send a ping request within 20 seconds -

I/flutter ( 9767): 1-2021-05-03 16:06:58.648442 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter ( 9767): 1-2021-05-03 16:06:59.012432 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.pingResponse

We now do not need to send another ping request until 16:07:18, however this doesn't seem to happen so we get this -

broker - 2021-05-03T15:07:30: Client 1004 has exceeded timeout, disconnecting. I/flutter ( 9767): 1-2021-05-03 16:07:32.308561 -- MqttConnectionBase::_onDone - calling disconnected callback

So the client is not sending a ping request on time, I will look at this.

What happens if you turn off keepalive?

Husnain-Asharf commented 3 years ago

I set keepAlivePeriod to 0 then i check logs. It was constantly making pingRequest. Is this correct behavior? Following are logs

Client logs

I/flutter (31050): 2-2021-05-04 16:16:09.983834 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (31050): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (31050): 2-2021-05-04 16:16:09.985246 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (31050): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (31050): 2-2021-05-04 16:16:09.985617 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (31050): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (31050): 2-2021-05-04 16:16:09.985920 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (31050): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (31050): 2-2021-05-04 16:16:09.986217 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (31050): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (31050): 2-2021-05-04 16:16:09.986473 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (31050): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (31050): 2-2021-05-04 16:16:09.986714 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (31050): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (31050): 2-2021-05-04 16:16:09.986960 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (31050): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (31050): 2-2021-05-04 16:16:09.987237 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (31050): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (31050): 2-2021-05-04 16:16:09.987485 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (31050): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (31050): 2-2021-05-04 16:16:09.987723 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (31050): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (31050): 2-2021-05-04 16:16:09.987962 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest

Code for mqtt connection

Future _login() async { // With await, we are assured of getting a string back and not a // Future placeholder instance. client = MqttServerClient.withPort(Constants.serverUri,this.topicpart, Constants.port); // Turn on mqtt package's logging while in test. client.logging(on: true);

client.keepAlivePeriod = 0;

/// Set auto reconnect

client.autoReconnect = true;

/// If you do not want active confirmed subscriptions to be automatically re subscribed
/// by the auto connect sequence do the following, otherwise leave this defaulted.

client.resubscribeOnAutoReconnect = false;

/// Add an auto reconnect callback.
/// This is the 'pre' auto re connect callback, called before the sequence starts.
client.onAutoReconnect = onAutoReconnect;

/// Add an auto reconnect callback.
/// This is the 'post' auto re connect callback, called after the sequence
/// has completed. Note that re subscriptions may be occurring when this callback
/// is invoked. See [resubscribeOnAutoReconnect] above.

client.onAutoReconnected = onAutoReconnected;

/// Add the unsolicited disconnection callback
client.onDisconnected = _onDisconnected;

/// Add the successful connection callback
client.onConnected = _onConnected;

/// Add a subscribed callback, there is also an unsubscribed callback if you need it.
/// You can add these before connection or change them dynamically after connection if
/// you wish. There is also an onSubscribeFail callback for failed subscriptions, these
/// can fail either because you have tried to subscribe to an invalid topic or the broker
/// rejects the subscribe request.
client.onSubscribed = _onSubscribed;
client.onSubscribeFail=_onUnSubscribed;
client.pongCallback = pong;
var lwt = {};
lwt["tid"]=this.topicpart;
lwt["type"]="lwt";
lwt["value"]="0";
final MqttConnectMessage connMess = MqttConnectMessage()
    .authenticateAs(Constants.user,Constants.password)
    .withClientIdentifier(this.topicpart)
    //.keepAliveFor(0) // Must agree with the keep alive set above or not set
    .withWillTopic('flutter_test/'+topicpart+'/lwt') // If you set this you must set a will message
    .withWillMessage(jsonEncode(lwt))
    //.startClean() // Non persistent session for testing
    .withWillQos(MqttQos.atLeastOnce);
   // .withWillRetain();
print('client connecting....');
client.connectionMessage = connMess;

/// Connect the client, any errors here are communicated by raising of the appropriate exception. Note
/// in some circumstances the broker will just disconnect us, see the spec about this, we however eill
/// never send malformed messages.
try {
  await client.connect(Constants.user,Constants.password);
} on Exception catch (e) {
  print('EXCEPTION::client exception - $e');
  await MqttUtilities.asyncSleep(5);
  if(client!=null)
  client.disconnect();
  client = null;
  return client;
}

/// Check we are connected
if (client.connectionStatus.state == MqttConnectionState.connected) {
  print('client connected');
} else {
  /// Use status here rather than state if you also want the broker return code.
  print(
      'client connection failed - disconnecting, status is ${client.connectionStatus}');
  await MqttUtilities.asyncSleep(5);
  if(client!=null)
  client.disconnect();
  client = null;
}
return client;

}

shamblett commented 3 years ago

Keep alive of 0 should disable keep alive, so the client shouldn't send any ping requests, I'll look at this. Has your disconnection problem gone away? The broker should not now be disconnecting you for keep alive purposes.

Husnain-Asharf commented 3 years ago

yes broker is not disconnecting with keep alive 0 but client making instantly ping requests to broker it should not happen. I am waiting for you response regarding keep alive. Because i want to use 60s keep alive.

shamblett commented 3 years ago

I'll look at both these but its going to need a code change so you will need to upgrade to the latest package version when I've done this.

Husnain-Asharf commented 3 years ago

ok i am waiting thanks

Husnain-Asharf commented 3 years ago

Hi @shamblett any progress ?

shamblett commented 3 years ago

I need to reproduce why in your case the client stops sending ping requests, this may be lengthy, however fixing the keep alive to be disabled when a value of 0 is used is straightforward, I 'll fix this so you can at least run your system without keep alive and re publish the package. At the same time I'll add extra logging in and around keep alive to see what's going on better in this area.

This will be ready when its ready, it may be end of this week or early next week, unfortunately maintaining these packages is not my day job, its done in my spare time like most OS development so there are no timescales for any of this.

Husnain-Asharf commented 3 years ago

Thanks buddy

Husnain-Asharf commented 3 years ago

Hi @shamblett

Client Logs

I/flutter (19623): 1-2021-05-06 16:32:17.674305 -- MqttConnection::_onData I/flutter (19623): 1-2021-05-06 16:32:17.675422 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.publishAck I/flutter (19623): Header: MessageType = MqttMessageType.publishAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter (19623): PublishAck Variable Header: MessageIdentifier={21} I/flutter (19623): 1-2021-05-06 16:32:17.676215 -- MqttServerConnection::_onData - message available event fired I/flutter (19623): 1-2021-05-06 16:32:17.676839 -- MqttConnectionHandlerBase::messageAvailable - message type is MqttMessageType.publishAck I/flutter (19623): 1-2021-05-06 16:32:17.677296 -- PublishingManager::handlePublishAcknowledgement for message id 21 I/flutter (19623): 1-2021-05-06 16:32:28.898990 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest I/flutter (19623): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (19623): 1-2021-05-06 16:32:29.056284 -- MqttConnection::_onData I/flutter (19623): 1-2021-05-06 16:32:29.058048 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.pingResponse I/flutter (19623): Header: MessageType = MqttMessageType.pingResponse, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (19623): 1-2021-05-06 16:32:29.059484 -- MqttServerConnection::_onData - message available event fired I/flutter (19623): 1-2021-05-06 16:32:29.060511 -- MqttConnectionHandlerBase::messageAvailable - message type is MqttMessageType.pingResponse I/flutter (19623): EXAMPLE::Ping response client callback invoked - you may want to disconnect your broker here

shamblett commented 3 years ago

From the MQTT 3.1.1 spec -

The Keep Alive timer, measured in seconds, defines the maximum time interval between
messages received from a client. It enables the server to detect that the network
connection to a client has dropped, without having to wait for the long TCP/IP timeout.
The client has a responsibility to send a message within each Keep Alive time period. In
the absence of a data-related message during the time period, the client sends a
PINGREQ message, which the server acknowledges with a PINGRESP message.

If the server does not receive a message from the client within one and a half times the
Keep Alive time period (the client is allowed "grace" of half a time period), it disconnects
the client as if the client had sent a DISCONNECT message. This action does not impact
any of the client's subscriptions. See DISCONNECT for more details.

In practice we don't stop sending ping requests if the client sends a control message, we just send them all the time, the broker just responds with a ping response. So if the keep alive period is 20 seconds we send a ping request every 20 seconds regardless of when the last control message was sent.

shamblett commented 3 years ago

Package re published at version 9.3.0. Extra logging now in place so we should be able to see better what is happening, please re test.

Husnain-Asharf commented 3 years ago

thanks buddy I will check now.

Husnain-Asharf commented 3 years ago

Hi I tried 9.3.0 version with keepalive 60s. It's getting disconnect after ping response received. This happen randomly not fix duration pattern mostly happen when phone are not in use means phone is idle.

Client Logs

27:24.9170 (info) flutter 1-2021-05-09 21:27:24.916140 -- MqttConnection::_onData 21:27:24.9180 (info) flutter 1-2021-05-09 21:27:24.916525 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.publishAck 21:27:24.9180 (info) flutter Header: MessageType = MqttMessageType.publishAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 21:27:24.9180 (info) flutter PublishAck Variable Header: MessageIdentifier={20} 21:27:24.9180 (info) flutter 1-2021-05-09 21:27:24.916734 -- MqttServerConnection::_onData - message available event fired 21:27:24.9180 (info) flutter 1-2021-05-09 21:27:24.916879 -- MqttConnectionHandlerBase::messageAvailable - message type is MqttMessageType.publishAck 21:27:24.9190 (info) flutter 1-2021-05-09 21:27:24.916938 -- PublishingManager::handlePublishAcknowledgement for message id 20 21:27:30.2710 (info) flutter 1-2021-05-09 21:27:30.267380 -- MqttConnectionKeepAlive::pingRequired 21:27:30.2710 (info) flutter 1-2021-05-09 21:27:30.267864 -- MqttConnectionKeepAlive::pingRequired - sending ping request 21:27:30.2710 (info) flutter 1-2021-05-09 21:27:30.267973 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest 21:27:30.2710 (info) flutter Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 21:27:30.2720 (info) flutter 1-2021-05-09 21:27:30.269159 -- MqttConnectionKeepAlive::pingRequired - restarting ping timer 21:27:30.4200 (info) flutter 1-2021-05-09 21:27:30.418711 -- MqttConnection::_onData 21:27:30.4200 (info) flutter 1-2021-05-09 21:27:30.419037 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.pingResponse 21:27:30.4200 (info) flutter Header: MessageType = MqttMessageType.pingResponse, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 21:27:30.4210 (info) flutter 1-2021-05-09 21:27:30.419242 -- MqttServerConnection::_onData - message available event fired 21:27:30.4210 (info) flutter 1-2021-05-09 21:27:30.419386 -- MqttConnectionHandlerBase::messageAvailable - message type is MqttMessageType.pingResponse 21:27:30.4210 (info) flutter 1-2021-05-09 21:27:30.419444 -- MqttConnectionKeepAlive::pingResponseReceived 21:27:30.4210 (info) flutter EXAMPLE::Ping response client callback invoked - you may want to disconnect your broker here 21:29:02.8880 (info) flutter 1-2021-05-09 21:29:02.884331 -- MqttConnectionBase::_onDone - calling disconnected callback 21:29:02.8880 (info) flutter 1-2021-05-09 21:29:02.884929 -- MqttConnectionHandlerBase::autoReconnect entered 21:29:02.8890 (info) flutter EXAMPLE::onAutoReconnect client callback - Client auto reconnection sequence will start 21:29:02.8890 (info) flutter 1-2021-05-09 21:29:02.885063 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection 21:29:02.8890 (info) flutter 1-2021-05-09 21:29:02.885131 -- MqttConnectionHandlerBase::connect - server broker.xs4arabia.com, port 1883 21:29:02.8890 (info) flutter 1-2021-05-09 21:29:02.885187 -- SynchronousMqttServerConnectionHandler::internalConnect entered 21:29:02.8890 (info) flutter 1-2021-05-09 21:29:02.885234 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true 21:29:02.8890 (info) flutter 1-2021-05-09 21:29:02.885292 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto 21:29:02.8890 (info) flutter 1-2021-05-09 21:29:02.885386 -- MqttNormalConnection::connectAuto - entered 21:29:03.1250 (info) flutter 1-2021-05-09 21:29:03.039837 -- MqttServerConnection::_startListening 21:29:03.1250 (info) flutter 1-2021-05-09 21:29:03.040328 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete 21:29:03.1250 (info) flutter 1-2021-05-09 21:29:03.040427 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message 21:29:03.1250 (info) flutter 1-2021-05-09 21:29:03.040484 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect 21:29:03.1260 (info) flutter Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 103 21:29:03.1260 (info) flutter Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=false, WillFlag=true, WillQos=MqttQos.atLeastOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60 21:29:03.1260 (info) flutter MqttConnectPayload - client identifier is : 1004 21:29:03.1260 (info) flutter 1-2021-05-09 21:29:03.052655 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 21:29:03.2180 (info) flutter 1-2021-05-09 21:29:03.213192 -- MqttConnection::_onData 21:29:03.2180 (info) flutter 1-2021-05-09 21:29:03.214227 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck 21:29:03.2180 (info) flutter Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 21:29:03.2190 (info) flutter Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} 21:29:03.2220 (info) flutter 1-2021-05-09 21:29:03.215202 -- MqttServerConnection::_onData - message available event fired 21:29:03.2350 (info) flutter 1-2021-05-09 21:29:03.222904 -- MqttConnectionHandlerBase::_connectAckProcessor 21:29:03.2350 (info) flutter 1-2021-05-09 21:29:03.223390 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected 21:29:03.2360 (info) flutter MQTTClientWrapper::OnConnected client callback - Client connection was sucessful

shamblett commented 3 years ago

Looking at the above -

21:27:30.2710 (info) flutter 1-2021-05-09 21:27:30.267864 -- MqttConnectionKeepAlive::pingRequired - sending ping request
21:27:30.2710 (info) flutter 1-2021-05-09 21:27:30.267973 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest
21:27:30.2710 (info) flutter Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0
21:27:30.2720 (info) flutter 1-2021-05-09 21:27:30.269159 -- MqttConnectionKeepAlive::pingRequired - restarting ping timer

The pingtimer is restarted at 21:27:30, so we would expect it to expire at 21:28:30 or thereabouts, but we get this -

21:29:02.8880 (info) flutter 1-2021-05-09 21:29:02.884331 -- MqttConnectionBase::_onDone - calling disconnected callback

So nothing happens until 21:29:02 when the broker disconnects. It looks as though the app has somehow suspended itself so the timer doesn't expire but it still responds to purely external events such as the disconnect coming from the network.

'This happen randomly not fix duration pattern mostly happen when phone are not in use means phone is idle.' Not sure what this means, what do you mean by idle?

Drop the keepalive to 5 seconds and run your app but keep it active, get the log from this, you should see ping request/responses every 5 seconds, then allow it to go 'idle' as you call it, see if it stops.

I can't see this being the client, it doesn't happen in the VM and no one else has reported this problem, something in your environment is stopping the ping timer expiry.

gazialankus commented 3 years ago

I'm having this exact issue. However I don't see anything related to ping in logs.

Funny thing is, it was working fine like a month ago and nothing really changed, same old Flutter and library version.

I just upgraded Flutter and this library to latest, still the same.

I just see this line and get disconnected. Nothing about ping in any logs. How should I debug this?

I/flutter ( 5205): 1-2021-05-26 11:58:05.559120 -- MqttConnectionBase::_onDone - calling disconnected callback
shamblett commented 3 years ago

'Funny thing is, it was working fine like a month ago and nothing really changed..' well, if it suddenly stopped working something must have changed somewhere. You won't see any ping info in the logs unless you have keep alive enabled on the client. Your only recourse is to look at your broker logs and see why its disconnecting you.

gazialankus commented 3 years ago

Thank you for the swift response. I don't operate the server but I'll try to get logs from there as well.

I just enabled keep alive and reconnect:

  client.autoReconnect = true;
  client.keepAlivePeriod = 60;

But again no pings. Below is logs from part of the loop that it gets into. Do you see anything suspicious?

Here are some logs:


I/flutter ( 8763): INFO: 2021-05-26 12:16:33.866285: --------------------------------------------------------------------------------
I/flutter ( 8763): INFO: 2021-05-26 12:16:33.867356: MQTT Connected
I/flutter ( 8763): 1-2021-05-26 12:16:33.868512 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter ( 8763): 1-2021-05-26 12:16:33.870840 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:33.871784 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:33.873173 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter ( 8763): 1-2021-05-26 12:16:33.874329 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true
I/flutter ( 8763): 1-2021-05-26 12:16:33.974791 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter ( 8763): 1-2021-05-26 12:16:33.976395 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:33.977412 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter ( 8763): 1-2021-05-26 12:16:33.978328 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter ( 8763): 1-2021-05-26 12:16:33.979414 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:33.980223 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter ( 8763): 1-2021-05-26 12:16:33.980966 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter ( 8763): 1-2021-05-26 12:16:33.981764 -- MqttNormalConnection::connectAuto - entered
I/flutter ( 8763): 1-2021-05-26 12:16:34.064968 -- MqttServerConnection::_startListening
I/flutter ( 8763): 1-2021-05-26 12:16:34.066718 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter ( 8763): 1-2021-05-26 12:16:34.067955 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter ( 8763): 1-2021-05-26 12:16:34.069063 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter ( 8763): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter ( 8763): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter ( 8763): MqttConnectPayload - client identifier is : mHealth
I/flutter ( 8763): 1-2021-05-26 12:16:34.072517 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:34.160390 -- MqttConnection::_onData
I/flutter ( 8763): 1-2021-05-26 12:16:34.161331 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter ( 8763): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter ( 8763): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter ( 8763): 1-2021-05-26 12:16:34.162776 -- MqttServerConnection::_onData - message available event fired
I/flutter ( 8763): 1-2021-05-26 12:16:34.163930 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter ( 8763): 1-2021-05-26 12:16:34.164701 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter ( 8763): INFO: 2021-05-26 12:16:34.165449: --------------------------------------------------------------------------------
I/flutter ( 8763): INFO: 2021-05-26 12:16:34.166857: MQTT Connected
I/flutter ( 8763): 1-2021-05-26 12:16:34.167728 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter ( 8763): 1-2021-05-26 12:16:34.170395 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:34.171456 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:34.172753 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter ( 8763): 1-2021-05-26 12:16:34.174024 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true
I/flutter ( 8763): 1-2021-05-26 12:16:34.271550 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter ( 8763): 1-2021-05-26 12:16:34.273307 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:34.274178 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter ( 8763): 1-2021-05-26 12:16:34.275133 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter ( 8763): 1-2021-05-26 12:16:34.275936 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:34.276541 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter ( 8763): 1-2021-05-26 12:16:34.277199 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter ( 8763): 1-2021-05-26 12:16:34.277711 -- MqttNormalConnection::connectAuto - entered
I/flutter ( 8763): 1-2021-05-26 12:16:34.365226 -- MqttServerConnection::_startListening
I/flutter ( 8763): 1-2021-05-26 12:16:34.366431 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter ( 8763): 1-2021-05-26 12:16:34.367185 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter ( 8763): 1-2021-05-26 12:16:34.367814 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter ( 8763): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter ( 8763): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter ( 8763): MqttConnectPayload - client identifier is : mHealth
I/flutter ( 8763): 1-2021-05-26 12:16:34.370289 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:34.446309 -- MqttConnection::_onData
I/flutter ( 8763): 1-2021-05-26 12:16:34.447329 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter ( 8763): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter ( 8763): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter ( 8763): 1-2021-05-26 12:16:34.448530 -- MqttServerConnection::_onData - message available event fired
I/flutter ( 8763): 1-2021-05-26 12:16:34.449632 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter ( 8763): 1-2021-05-26 12:16:34.450324 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter ( 8763): INFO: 2021-05-26 12:16:34.451158: --------------------------------------------------------------------------------
I/flutter ( 8763): INFO: 2021-05-26 12:16:34.452223: MQTT Connected
I/flutter ( 8763): 1-2021-05-26 12:16:34.453251 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter ( 8763): 1-2021-05-26 12:16:34.455550 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:34.456476 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:34.457873 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter ( 8763): 1-2021-05-26 12:16:34.459404 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true
I/flutter ( 8763): 1-2021-05-26 12:16:34.579575 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter ( 8763): 1-2021-05-26 12:16:34.581500 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:34.582349 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter ( 8763): 1-2021-05-26 12:16:34.583374 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter ( 8763): 1-2021-05-26 12:16:34.584264 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:34.584886 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter ( 8763): 1-2021-05-26 12:16:34.585773 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter ( 8763): 1-2021-05-26 12:16:34.586638 -- MqttNormalConnection::connectAuto - entered
I/flutter ( 8763): 1-2021-05-26 12:16:34.671970 -- MqttServerConnection::_startListening
I/flutter ( 8763): 1-2021-05-26 12:16:34.673373 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter ( 8763): 1-2021-05-26 12:16:34.674032 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter ( 8763): 1-2021-05-26 12:16:34.674796 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter ( 8763): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter ( 8763): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter ( 8763): MqttConnectPayload - client identifier is : mHealth
I/flutter ( 8763): 1-2021-05-26 12:16:34.678015 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:35.526611 -- MqttConnection::_onData
I/flutter ( 8763): 1-2021-05-26 12:16:35.527760 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter ( 8763): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter ( 8763): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter ( 8763): 1-2021-05-26 12:16:35.529173 -- MqttServerConnection::_onData - message available event fired
I/flutter ( 8763): 1-2021-05-26 12:16:35.530396 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter ( 8763): 1-2021-05-26 12:16:35.531764 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter ( 8763): INFO: 2021-05-26 12:16:35.533422: --------------------------------------------------------------------------------
I/flutter ( 8763): INFO: 2021-05-26 12:16:35.535073: MQTT Connected
I/flutter ( 8763): 1-2021-05-26 12:16:35.536333 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter ( 8763): 1-2021-05-26 12:16:35.538659 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:35.539584 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:35.540942 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter ( 8763): 1-2021-05-26 12:16:35.542021 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true
I/flutter ( 8763): 1-2021-05-26 12:16:35.544547 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter ( 8763): 1-2021-05-26 12:16:35.546199 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:35.547157 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter ( 8763): 1-2021-05-26 12:16:35.548013 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter ( 8763): 1-2021-05-26 12:16:35.548683 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:35.549442 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter ( 8763): 1-2021-05-26 12:16:35.550320 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter ( 8763): 1-2021-05-26 12:16:35.551254 -- MqttNormalConnection::connectAuto - entered
I/flutter ( 8763): 1-2021-05-26 12:16:35.885423 -- MqttServerConnection::_startListening
I/flutter ( 8763): 1-2021-05-26 12:16:35.886639 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter ( 8763): 1-2021-05-26 12:16:35.887367 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter ( 8763): 1-2021-05-26 12:16:35.888106 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter ( 8763): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter ( 8763): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter ( 8763): MqttConnectPayload - client identifier is : mHealth
I/flutter ( 8763): 1-2021-05-26 12:16:35.890711 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:37.691838 -- MqttConnection::_onData
I/flutter ( 8763): 1-2021-05-26 12:16:37.692847 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter ( 8763): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter ( 8763): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter ( 8763): 1-2021-05-26 12:16:37.694141 -- MqttServerConnection::_onData - message available event fired
I/flutter ( 8763): 1-2021-05-26 12:16:37.695387 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter ( 8763): 1-2021-05-26 12:16:37.696275 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter ( 8763): INFO: 2021-05-26 12:16:37.697019: --------------------------------------------------------------------------------
I/flutter ( 8763): INFO: 2021-05-26 12:16:37.698315: MQTT Connected
I/flutter ( 8763): 1-2021-05-26 12:16:37.699486 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter ( 8763): 1-2021-05-26 12:16:37.701898 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:37.703053 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:37.704192 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter ( 8763): 1-2021-05-26 12:16:37.705422 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true
I/flutter ( 8763): 1-2021-05-26 12:16:37.859224 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter ( 8763): 1-2021-05-26 12:16:37.860644 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:37.861618 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter ( 8763): 1-2021-05-26 12:16:37.862313 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter ( 8763): 1-2021-05-26 12:16:37.863338 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:37.864086 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter ( 8763): 1-2021-05-26 12:16:37.864833 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter ( 8763): 1-2021-05-26 12:16:37.865592 -- MqttNormalConnection::connectAuto - entered
I/flutter ( 8763): 1-2021-05-26 12:16:37.953590 -- MqttServerConnection::_startListening
I/flutter ( 8763): 1-2021-05-26 12:16:37.955064 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter ( 8763): 1-2021-05-26 12:16:37.955897 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter ( 8763): 1-2021-05-26 12:16:37.956692 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter ( 8763): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter ( 8763): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter ( 8763): MqttConnectPayload - client identifier is : mHealth
I/flutter ( 8763): 1-2021-05-26 12:16:37.959729 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.031472 -- MqttConnection::_onData
I/flutter ( 8763): 1-2021-05-26 12:16:38.032472 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter ( 8763): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter ( 8763): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter ( 8763): 1-2021-05-26 12:16:38.033523 -- MqttServerConnection::_onData - message available event fired
I/flutter ( 8763): 1-2021-05-26 12:16:38.034762 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter ( 8763): 1-2021-05-26 12:16:38.035696 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter ( 8763): INFO: 2021-05-26 12:16:38.036647: --------------------------------------------------------------------------------
I/flutter ( 8763): INFO: 2021-05-26 12:16:38.037958: MQTT Connected
I/flutter ( 8763): 1-2021-05-26 12:16:38.039043 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter ( 8763): 1-2021-05-26 12:16:38.041351 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.042243 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.043787 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter ( 8763): 1-2021-05-26 12:16:38.045040 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true
I/flutter ( 8763): 1-2021-05-26 12:16:38.158814 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter ( 8763): 1-2021-05-26 12:16:38.160232 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:38.161146 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter ( 8763): 1-2021-05-26 12:16:38.161908 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter ( 8763): 1-2021-05-26 12:16:38.163038 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:38.163684 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter ( 8763): 1-2021-05-26 12:16:38.164454 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter ( 8763): 1-2021-05-26 12:16:38.165361 -- MqttNormalConnection::connectAuto - entered
I/flutter ( 8763): 1-2021-05-26 12:16:38.247431 -- MqttServerConnection::_startListening
I/flutter ( 8763): 1-2021-05-26 12:16:38.248712 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter ( 8763): 1-2021-05-26 12:16:38.249604 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter ( 8763): 1-2021-05-26 12:16:38.250634 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter ( 8763): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter ( 8763): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter ( 8763): MqttConnectPayload - client identifier is : mHealth
I/flutter ( 8763): 1-2021-05-26 12:16:38.253987 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.328907 -- MqttConnection::_onData
I/flutter ( 8763): 1-2021-05-26 12:16:38.329862 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter ( 8763): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter ( 8763): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter ( 8763): 1-2021-05-26 12:16:38.331244 -- MqttServerConnection::_onData - message available event fired
I/flutter ( 8763): 1-2021-05-26 12:16:38.333110 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter ( 8763): 1-2021-05-26 12:16:38.334611 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter ( 8763): INFO: 2021-05-26 12:16:38.335814: --------------------------------------------------------------------------------
I/flutter ( 8763): INFO: 2021-05-26 12:16:38.337328: MQTT Connected
I/flutter ( 8763): 1-2021-05-26 12:16:38.338200 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter ( 8763): 1-2021-05-26 12:16:38.340355 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.341192 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.342585 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter ( 8763): 1-2021-05-26 12:16:38.343919 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true
I/flutter ( 8763): 1-2021-05-26 12:16:38.454259 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter ( 8763): 1-2021-05-26 12:16:38.455925 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:38.456902 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter ( 8763): 1-2021-05-26 12:16:38.457781 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter ( 8763): 1-2021-05-26 12:16:38.458610 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:38.459202 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter ( 8763): 1-2021-05-26 12:16:38.460 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter ( 8763): 1-2021-05-26 12:16:38.460693 -- MqttNormalConnection::connectAuto - entered
I/flutter ( 8763): 1-2021-05-26 12:16:38.543272 -- MqttServerConnection::_startListening
I/flutter ( 8763): 1-2021-05-26 12:16:38.546323 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter ( 8763): 1-2021-05-26 12:16:38.547186 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter ( 8763): 1-2021-05-26 12:16:38.547821 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter ( 8763): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter ( 8763): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter ( 8763): MqttConnectPayload - client identifier is : mHealth
I/flutter ( 8763): 1-2021-05-26 12:16:38.550760 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.626743 -- MqttConnection::_onData
I/flutter ( 8763): 1-2021-05-26 12:16:38.627900 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter ( 8763): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter ( 8763): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter ( 8763): 1-2021-05-26 12:16:38.629438 -- MqttServerConnection::_onData - message available event fired
I/flutter ( 8763): 1-2021-05-26 12:16:38.630993 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter ( 8763): 1-2021-05-26 12:16:38.631756 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter ( 8763): INFO: 2021-05-26 12:16:38.632663: --------------------------------------------------------------------------------
I/flutter ( 8763): INFO: 2021-05-26 12:16:38.633728: MQTT Connected
I/flutter ( 8763): 1-2021-05-26 12:16:38.634793 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter ( 8763): 1-2021-05-26 12:16:38.636925 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.637902 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.639283 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter ( 8763): 1-2021-05-26 12:16:38.640495 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true
I/flutter ( 8763): 1-2021-05-26 12:16:38.746230 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter ( 8763): 1-2021-05-26 12:16:38.748236 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:38.748978 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter ( 8763): 1-2021-05-26 12:16:38.749832 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter ( 8763): 1-2021-05-26 12:16:38.750539 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter ( 8763): 1-2021-05-26 12:16:38.751130 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter ( 8763): 1-2021-05-26 12:16:38.751833 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter ( 8763): 1-2021-05-26 12:16:38.752567 -- MqttNormalConnection::connectAuto - entered
I/flutter ( 8763): 1-2021-05-26 12:16:38.846353 -- MqttServerConnection::_startListening
I/flutter ( 8763): 1-2021-05-26 12:16:38.847654 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter ( 8763): 1-2021-05-26 12:16:38.848640 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter ( 8763): 1-2021-05-26 12:16:38.849429 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter ( 8763): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter ( 8763): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter ( 8763): MqttConnectPayload - client identifier is : mHealth
I/flutter ( 8763): 1-2021-05-26 12:16:38.852513 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.926651 -- MqttConnection::_onData
I/flutter ( 8763): 1-2021-05-26 12:16:38.927585 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter ( 8763): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter ( 8763): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter ( 8763): 1-2021-05-26 12:16:38.928643 -- MqttServerConnection::_onData - message available event fired
I/flutter ( 8763): 1-2021-05-26 12:16:38.929817 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter ( 8763): 1-2021-05-26 12:16:38.930833 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter ( 8763): INFO: 2021-05-26 12:16:38.931561: --------------------------------------------------------------------------------
I/flutter ( 8763): INFO: 2021-05-26 12:16:38.932418: MQTT Connected
I/flutter ( 8763): 1-2021-05-26 12:16:38.933291 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter ( 8763): 1-2021-05-26 12:16:38.935422 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.936480 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter ( 8763): 1-2021-05-26 12:16:38.937768 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter ( 8763): 1-2021-05-26 12:16:38.938828 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true```
gazialankus commented 3 years ago

These seem to be on the stack when disconnecting. Can we say that the server is closing the TCP connection? Btw, MQTTExplorer receives messages just fine when connected to the same topic. image

shamblett commented 3 years ago

You are reconnecting from auto reconnect then immediately disconnecting for some reason when the client tries to re subscribe -

I/flutter ( 8763): 1-2021-05-26 12:16:33.873173 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter ( 8763): 1-2021-05-26 12:16:33.874329 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true
I/flutter ( 8763): 1-2021-05-26 12:16:33.974791 -- MqttConnectionBase::_onDone - calling disconnected callback

Try disabling auto resubscribe on auto reconnect.

gazialankus commented 3 years ago

Try disabling auto resubscribe on auto reconnect.

That was it! Thank you @shamblett! Sorry @Husnain-Asharf if I hijacked your thread.

shamblett commented 3 years ago

Auto re subscribe should work, please check that the MQTT version you set on the client matches your broker version, particularly if your broker is a 3.1.1 broker.

gazialankus commented 3 years ago

Well, spoke too soon. After a while we get back into this loop. Also the code I said that worked is not anymore, oddly (second log below).

I/flutter (13938): INFO: 2021-05-26 12:42:48.129447: --------------------------------------------------------------------------------
I/flutter (13938): INFO: 2021-05-26 12:42:48.130540: MQTT Connected
I/flutter (13938): 1-2021-05-26 12:42:48.131541 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (13938): 1-2021-05-26 12:42:48.133387 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:48.135027 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:48.136353 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (13938): 1-2021-05-26 12:42:48.137580 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (13938): 1-2021-05-26 12:42:48.634824 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (13938): 1-2021-05-26 12:42:48.636287 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (13938): 1-2021-05-26 12:42:48.637267 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (13938): 1-2021-05-26 12:42:48.638139 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (13938): 1-2021-05-26 12:42:48.638863 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (13938): 1-2021-05-26 12:42:48.639554 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (13938): 1-2021-05-26 12:42:48.640362 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (13938): 1-2021-05-26 12:42:48.641012 -- MqttNormalConnection::connectAuto - entered
I/flutter (13938): 1-2021-05-26 12:42:48.728453 -- MqttServerConnection::_startListening
I/flutter (13938): 1-2021-05-26 12:42:48.729632 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (13938): 1-2021-05-26 12:42:48.730585 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (13938): 1-2021-05-26 12:42:48.731237 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (13938): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (13938): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (13938): MqttConnectPayload - client identifier is : mHealth
I/flutter (13938): 1-2021-05-26 12:42:48.733909 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:48.813123 -- MqttConnection::_onData
I/flutter (13938): 1-2021-05-26 12:42:48.814092 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (13938): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (13938): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (13938): 1-2021-05-26 12:42:48.815409 -- MqttServerConnection::_onData - message available event fired
I/flutter (13938): 1-2021-05-26 12:42:48.816479 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (13938): 1-2021-05-26 12:42:48.817393 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (13938): INFO: 2021-05-26 12:42:48.818095: --------------------------------------------------------------------------------
I/flutter (13938): INFO: 2021-05-26 12:42:48.819302: MQTT Connected
I/flutter (13938): 1-2021-05-26 12:42:48.820174 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (13938): 1-2021-05-26 12:42:48.821832 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:48.822747 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:48.823929 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (13938): 1-2021-05-26 12:42:48.825118 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (13938): 1-2021-05-26 12:42:49.146943 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (13938): 1-2021-05-26 12:42:49.148369 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (13938): 1-2021-05-26 12:42:49.149303 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (13938): 1-2021-05-26 12:42:49.150148 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (13938): 1-2021-05-26 12:42:49.150941 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (13938): 1-2021-05-26 12:42:49.151620 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (13938): 1-2021-05-26 12:42:49.152197 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (13938): 1-2021-05-26 12:42:49.153042 -- MqttNormalConnection::connectAuto - entered
I/flutter (13938): 1-2021-05-26 12:42:49.237716 -- MqttServerConnection::_startListening
I/flutter (13938): 1-2021-05-26 12:42:49.239043 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (13938): 1-2021-05-26 12:42:49.239639 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (13938): 1-2021-05-26 12:42:49.240257 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (13938): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (13938): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (13938): MqttConnectPayload - client identifier is : mHealth
I/flutter (13938): 1-2021-05-26 12:42:49.242315 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:49.353617 -- MqttConnection::_onData
I/flutter (13938): 1-2021-05-26 12:42:49.354652 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (13938): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (13938): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (13938): 1-2021-05-26 12:42:49.355875 -- MqttServerConnection::_onData - message available event fired
I/flutter (13938): 1-2021-05-26 12:42:49.357003 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (13938): 1-2021-05-26 12:42:49.357875 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (13938): INFO: 2021-05-26 12:42:49.358633: --------------------------------------------------------------------------------
I/flutter (13938): INFO: 2021-05-26 12:42:49.359703: MQTT Connected
I/flutter (13938): 1-2021-05-26 12:42:49.360681 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (13938): 1-2021-05-26 12:42:49.362975 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:49.363903 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:49.365248 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (13938): 1-2021-05-26 12:42:49.366553 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (13938): 1-2021-05-26 12:42:49.540917 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (13938): 1-2021-05-26 12:42:49.542817 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (13938): 1-2021-05-26 12:42:49.543668 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (13938): 1-2021-05-26 12:42:49.544445 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (13938): 1-2021-05-26 12:42:49.545138 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (13938): 1-2021-05-26 12:42:49.545836 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (13938): 1-2021-05-26 12:42:49.546676 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (13938): 1-2021-05-26 12:42:49.547343 -- MqttNormalConnection::connectAuto - entered
I/flutter (13938): 1-2021-05-26 12:42:49.627821 -- MqttServerConnection::_startListening
I/flutter (13938): 1-2021-05-26 12:42:49.628972 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (13938): 1-2021-05-26 12:42:49.629627 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (13938): 1-2021-05-26 12:42:49.630153 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (13938): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (13938): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (13938): MqttConnectPayload - client identifier is : mHealth
I/flutter (13938): 1-2021-05-26 12:42:49.632376 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:49.705373 -- MqttConnection::_onData
I/flutter (13938): 1-2021-05-26 12:42:49.706255 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (13938): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (13938): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (13938): 1-2021-05-26 12:42:49.707603 -- MqttServerConnection::_onData - message available event fired
I/flutter (13938): 1-2021-05-26 12:42:49.708558 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (13938): 1-2021-05-26 12:42:49.709152 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (13938): INFO: 2021-05-26 12:42:49.709833: --------------------------------------------------------------------------------
I/flutter (13938): INFO: 2021-05-26 12:42:49.710782: MQTT Connected
I/flutter (13938): 1-2021-05-26 12:42:49.711841 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (13938): 1-2021-05-26 12:42:49.714035 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:49.715019 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:49.716075 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (13938): 1-2021-05-26 12:42:49.717067 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (13938): 1-2021-05-26 12:42:49.902892 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (13938): 1-2021-05-26 12:42:49.904207 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (13938): 1-2021-05-26 12:42:49.905106 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (13938): 1-2021-05-26 12:42:49.905963 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (13938): 1-2021-05-26 12:42:49.906988 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (13938): 1-2021-05-26 12:42:49.908199 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (13938): 1-2021-05-26 12:42:49.909178 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (13938): 1-2021-05-26 12:42:49.910166 -- MqttNormalConnection::connectAuto - entered
I/flutter (13938): 1-2021-05-26 12:42:49.999717 -- MqttServerConnection::_startListening
I/flutter (13938): 1-2021-05-26 12:42:50.001017 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (13938): 1-2021-05-26 12:42:50.002070 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (13938): 1-2021-05-26 12:42:50.003004 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (13938): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (13938): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (13938): MqttConnectPayload - client identifier is : mHealth
I/flutter (13938): 1-2021-05-26 12:42:50.005866 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:50.083400 -- MqttConnection::_onData
I/flutter (13938): 1-2021-05-26 12:42:50.084224 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (13938): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (13938): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (13938): 1-2021-05-26 12:42:50.085371 -- MqttServerConnection::_onData - message available event fired
I/flutter (13938): 1-2021-05-26 12:42:50.086562 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (13938): 1-2021-05-26 12:42:50.087396 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (13938): INFO: 2021-05-26 12:42:50.088160: --------------------------------------------------------------------------------
I/flutter (13938): INFO: 2021-05-26 12:42:50.089133: MQTT Connected
I/flutter (13938): 1-2021-05-26 12:42:50.090153 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (13938): 1-2021-05-26 12:42:50.092859 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:50.094163 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:50.095630 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (13938): 1-2021-05-26 12:42:50.096855 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (13938): 1-2021-05-26 12:42:50.258659 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (13938): 1-2021-05-26 12:42:50.260159 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (13938): 1-2021-05-26 12:42:50.260994 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (13938): 1-2021-05-26 12:42:50.261844 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (13938): 1-2021-05-26 12:42:50.262588 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (13938): 1-2021-05-26 12:42:50.263336 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (13938): 1-2021-05-26 12:42:50.263968 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (13938): 1-2021-05-26 12:42:50.264597 -- MqttNormalConnection::connectAuto - entered
I/flutter (13938): 1-2021-05-26 12:42:50.351355 -- MqttServerConnection::_startListening
I/flutter (13938): 1-2021-05-26 12:42:50.352516 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (13938): 1-2021-05-26 12:42:50.353187 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (13938): 1-2021-05-26 12:42:50.353820 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (13938): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (13938): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (13938): MqttConnectPayload - client identifier is : mHealth
I/flutter (13938): 1-2021-05-26 12:42:50.356503 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:50.435551 -- MqttConnection::_onData
I/flutter (13938): 1-2021-05-26 12:42:50.436655 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (13938): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (13938): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (13938): 1-2021-05-26 12:42:50.438136 -- MqttServerConnection::_onData - message available event fired
I/flutter (13938): 1-2021-05-26 12:42:50.439493 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (13938): 1-2021-05-26 12:42:50.440483 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (13938): INFO: 2021-05-26 12:42:50.441526: --------------------------------------------------------------------------------
I/flutter (13938): INFO: 2021-05-26 12:42:50.442935: MQTT Connected
I/flutter (13938): 1-2021-05-26 12:42:50.444149 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (13938): 1-2021-05-26 12:42:50.446809 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:50.447846 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:50.448921 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (13938): 1-2021-05-26 12:42:50.450089 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (13938): 1-2021-05-26 12:42:50.622434 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (13938): 1-2021-05-26 12:42:50.624461 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (13938): 1-2021-05-26 12:42:50.625555 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (13938): 1-2021-05-26 12:42:50.626698 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (13938): 1-2021-05-26 12:42:50.627861 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (13938): 1-2021-05-26 12:42:50.628695 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (13938): 1-2021-05-26 12:42:50.629752 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (13938): 1-2021-05-26 12:42:50.630696 -- MqttNormalConnection::connectAuto - entered
I/flutter (13938): 1-2021-05-26 12:42:50.712851 -- MqttServerConnection::_startListening
I/flutter (13938): 1-2021-05-26 12:42:50.714046 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (13938): 1-2021-05-26 12:42:50.715045 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (13938): 1-2021-05-26 12:42:50.715748 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (13938): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (13938): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (13938): MqttConnectPayload - client identifier is : mHealth
I/flutter (13938): 1-2021-05-26 12:42:50.718613 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:50.789711 -- MqttConnection::_onData
I/flutter (13938): 1-2021-05-26 12:42:50.790705 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (13938): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (13938): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (13938): 1-2021-05-26 12:42:50.791916 -- MqttServerConnection::_onData - message available event fired
I/flutter (13938): 1-2021-05-26 12:42:50.792986 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (13938): 1-2021-05-26 12:42:50.793748 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (13938): INFO: 2021-05-26 12:42:50.794600: --------------------------------------------------------------------------------
I/flutter (13938): INFO: 2021-05-26 12:42:50.795724: MQTT Connected
I/flutter (13938): 1-2021-05-26 12:42:50.796525 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (13938): 1-2021-05-26 12:42:50.798281 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:50.799111 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:50.800952 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (13938): 1-2021-05-26 12:42:50.801847 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (13938): 1-2021-05-26 12:42:51.093646 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (13938): 1-2021-05-26 12:42:51.095323 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (13938): 1-2021-05-26 12:42:51.096539 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (13938): 1-2021-05-26 12:42:51.097719 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (13938): 1-2021-05-26 12:42:51.098387 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (13938): 1-2021-05-26 12:42:51.099226 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (13938): 1-2021-05-26 12:42:51.099882 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (13938): 1-2021-05-26 12:42:51.100683 -- MqttNormalConnection::connectAuto - entered
I/flutter (13938): 1-2021-05-26 12:42:51.273738 -- MqttServerConnection::_startListening
I/flutter (13938): 1-2021-05-26 12:42:51.274998 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (13938): 1-2021-05-26 12:42:51.275962 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (13938): 1-2021-05-26 12:42:51.276668 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (13938): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (13938): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (13938): MqttConnectPayload - client identifier is : mHealth
I/flutter (13938): 1-2021-05-26 12:42:51.279024 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:51.453213 -- MqttConnection::_onData
I/flutter (13938): 1-2021-05-26 12:42:51.454114 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (13938): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (13938): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (13938): 1-2021-05-26 12:42:51.455509 -- MqttServerConnection::_onData - message available event fired
I/flutter (13938): 1-2021-05-26 12:42:51.456542 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (13938): 1-2021-05-26 12:42:51.457363 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (13938): INFO: 2021-05-26 12:42:51.458038: --------------------------------------------------------------------------------
I/flutter (13938): INFO: 2021-05-26 12:42:51.459116: MQTT Connected
I/flutter (13938): 1-2021-05-26 12:42:51.460089 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (13938): 1-2021-05-26 12:42:51.462340 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:51.463250 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (13938): 1-2021-05-26 12:42:51.464552 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (13938): 1-2021-05-26 12:42:51.465560 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (13938): 1-2021-05-26 12:42:51.634070 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (13938): 1-2021-05-26 12:42:51.635621 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (13938): 1-2021-05-26 12:42:51.636332 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (13938): 1-2021-05-26 12:42:51.636908 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (13938): 1-2021-05-26 12:42:51.637533 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (13938): 1-2021-05-26 12:42:51.638147 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (13938): 1-2021-05-26 12:42:51.638773 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (13938): 1-2021-05-26 12:42:51.639630 -- MqttNormalConnection::connectAuto - entered

The code that I said that works fine is also looping again:

I/flutter (17858): INFO: 2021-05-26 12:58:46.166864: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:46.168167: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:46.169326 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:46.171870 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:46.172890 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:46.174237 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:46.175641 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:46.588647 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:46.590418 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:46.591430 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:46.592156 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:46.592935 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:46.593629 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:46.594435 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:46.595413 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:46.707607 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:46.708963 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:46.709971 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:46.710727 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:46.714184 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:46.795953 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:46.796923 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:46.798231 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:46.799591 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:46.800485 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:46.801278: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:46.802725: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:46.803983 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:46.806341 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:46.807568 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:46.809102 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:46.810356 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:47.064228 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:47.065771 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:47.066847 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:47.067698 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:47.068411 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:47.069016 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:47.069673 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:47.070269 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:47.158973 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:47.160375 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:47.161306 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:47.162225 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:47.165126 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:47.244992 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:47.245954 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:47.247332 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:47.248549 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:47.249471 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:47.250290: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:47.251742: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:47.252857 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:47.255434 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:47.256549 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:47.257967 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:47.259352 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:47.563287 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:47.564906 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:47.565883 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:47.566853 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:47.567584 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:47.568269 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:47.569083 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:47.570023 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:47.649911 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:47.651607 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:47.652915 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:47.654204 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:47.658139 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:47.728931 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:47.730024 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:47.731257 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:47.732425 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:47.733257 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:47.734225: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:47.735566: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:47.736660 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:47.739053 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:47.740129 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:47.741372 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:47.742778 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:48.124033 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:48.126714 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:48.127711 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:48.128495 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:48.129319 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:48.130066 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:48.131548 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:48.132280 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:48.215660 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:48.217170 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:48.218046 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:48.219107 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:48.222724 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:48.298701 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:48.299691 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:48.301019 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:48.301998 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:48.302830 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:48.303717: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:48.304866: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:48.306030 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:48.308728 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:48.309700 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:48.311229 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:48.312562 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:49.560707 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:49.562101 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:49.562935 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:49.563626 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:49.564177 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:49.564877 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:49.565736 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:49.566619 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:49.656642 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:49.658024 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:49.658971 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:49.659772 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:49.663636 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:49.740470 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:49.741444 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:49.742851 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:49.744043 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:49.744748 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:49.745454: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:49.746432: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:49.747316 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:49.749759 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:49.750984 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:49.752478 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:49.753690 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:50.070369 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:50.072251 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:50.073328 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:50.074344 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:50.075185 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:50.075985 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:50.076815 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:50.077471 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:50.162212 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:50.163909 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:50.165125 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:50.166275 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:50.169803 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:50.244061 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:50.245526 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:50.247587 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:50.248801 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:50.249793 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:50.250896: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:50.252535: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:50.253694 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:50.255944 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:50.256826 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:50.258135 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:50.259530 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:50.586135 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:50.587767 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:50.588456 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:50.589146 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:50.589701 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:50.590363 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:50.591129 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:50.591910 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:50.682934 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:50.684349 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:50.685184 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:50.685949 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:50.689222 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:50.764233 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:50.765195 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:50.766540 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:50.767783 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:50.768709 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:50.769697: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:50.771214: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:50.772340 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:50.774602 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:50.775751 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:50.776974 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:50.778342 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:51.094123 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:51.096511 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:51.097749 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:51.098961 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:51.100289 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:51.101580 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:51.102774 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:51.104100 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:51.192717 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:51.194402 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:51.195640 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:51.196751 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:51.200160 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:51.280191 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:51.281173 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:51.282582 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:51.283772 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:51.284391 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:51.285141: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:51.286237: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:51.287347 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:51.289863 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:51.290944 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:51.292317 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:51.293506 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:51.605860 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:51.607643 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:51.608525 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:51.609673 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:51.610301 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:51.611188 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:51.611997 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:51.612919 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:51.704512 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:51.706160 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:51.707257 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:51.708188 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:51.711468 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:51.782156 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:51.783191 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:51.784471 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:51.785643 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:51.786411 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:51.787180: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:51.788185: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:51.789284 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:51.791764 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:51.792721 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:51.794132 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:51.795417 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:52.119073 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:52.120906 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:52.121705 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:52.122686 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:52.123441 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:52.124076 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:52.124845 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:52.125862 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:52.216303 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:52.217593 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:52.218695 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:52.219505 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:52.222617 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:52.534631 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:52.535630 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:52.536955 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:52.538230 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:52.539181 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:52.540160: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:52.541484: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:52.542703 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:52.545076 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:52.546134 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:52.547511 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:52.548934 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:53.652413 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:53.654621 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:53.655623 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:53.656869 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:53.658100 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:53.659090 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:53.659954 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:53.660624 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:53.744019 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:53.745755 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:53.747048 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:53.748115 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:53.751267 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:53.825396 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:53.826527 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:53.827545 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:53.828510 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:53.829193 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:53.829937: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:53.831014: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:53.832254 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:53.834645 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:53.835672 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:53.836961 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:53.838217 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:58:54.677761 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (17858): 1-2021-05-26 12:58:54.679562 -- MqttConnectionHandlerBase::autoReconnect entered
I/flutter (17858): 1-2021-05-26 12:58:54.680429 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection
I/flutter (17858): 1-2021-05-26 12:58:54.681374 -- MqttConnectionHandlerBase::connect - server xxxx, port 8883
I/flutter (17858): 1-2021-05-26 12:58:54.682100 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (17858): 1-2021-05-26 12:58:54.682785 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true
I/flutter (17858): 1-2021-05-26 12:58:54.683485 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto
I/flutter (17858): 1-2021-05-26 12:58:54.684506 -- MqttNormalConnection::connectAuto - entered
I/flutter (17858): 1-2021-05-26 12:58:54.771869 -- MqttServerConnection::_startListening
I/flutter (17858): 1-2021-05-26 12:58:54.773627 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
I/flutter (17858): 1-2021-05-26 12:58:54.774795 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message
I/flutter (17858): 1-2021-05-26 12:58:54.775703 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect
I/flutter (17858): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 45
I/flutter (17858): Connect Variable Header: ProtocolName=MQIsdp, ProtocolVersion=3, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=60
I/flutter (17858): MqttConnectPayload - client identifier is : mHealth
I/flutter (17858): 1-2021-05-26 12:58:54.779012 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:54.856579 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:58:54.857580 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck
I/flutter (17858): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2
I/flutter (17858): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted}
I/flutter (17858): 1-2021-05-26 12:58:54.858775 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:58:54.859842 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (17858): 1-2021-05-26 12:58:54.860629 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected
I/flutter (17858): INFO: 2021-05-26 12:58:54.861339: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:58:54.862652: MQTT Connected
I/flutter (17858): 1-2021-05-26 12:58:54.863600 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (17858): 1-2021-05-26 12:58:54.866029 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:54.867156 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none
I/flutter (17858): 1-2021-05-26 12:58:54.869136 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete
I/flutter (17858): 1-2021-05-26 12:58:54.870790 -- Subscriptionsmanager::_resubscribe - NOT resubscribing from auto reconnect true, resubscribeOnAutoReconnect is false
I/flutter (17858): 1-2021-05-26 12:59:08.665402 -- MqttConnectionKeepAlive::pingRequired
I/flutter (17858): 1-2021-05-26 12:59:08.669891 -- MqttConnectionKeepAlive::pingRequired - sending ping request
I/flutter (17858): 1-2021-05-26 12:59:08.671014 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.pingRequest
I/flutter (17858): Header: MessageType = MqttMessageType.pingRequest, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0
I/flutter (17858): 1-2021-05-26 12:59:08.675894 -- MqttConnectionKeepAlive::pingRequired - restarting ping timer
I/flutter (17858): 1-2021-05-26 12:59:08.752657 -- MqttConnection::_onData
I/flutter (17858): 1-2021-05-26 12:59:08.754870 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.pingResponse
I/flutter (17858): Header: MessageType = MqttMessageType.pingResponse, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0
I/flutter (17858): 1-2021-05-26 12:59:08.757458 -- MqttServerConnection::_onData - message available event fired
I/flutter (17858): 1-2021-05-26 12:59:08.759186 -- MqttConnectionHandlerBase::messageAvailable - message type is MqttMessageType.pingResponse
I/flutter (17858): 1-2021-05-26 12:59:08.761713 -- MqttConnectionKeepAlive::pingResponseReceived
I/flutter (17858): INFO: 2021-05-26 12:59:08.764820: --------------------------------------------------------------------------------
I/flutter (17858): INFO: 2021-05-26 12:59:08.766180: MQTT Ping response client callback invoked

ok I'll check the 3.1.1 thing thanks.

gazialankus commented 3 years ago

Just for the record, 3.1.1 did not change anything here. I'll keep working on it to see if I can do anything.

shamblett commented 3 years ago

You need your broker logs, it should show you why you are being disconnected

gazialankus commented 3 years ago

Here's what my problem was: all my clients had the same client id. Giving unique client ids to clients solved it. I believe that when I connected, there was some other client running somewhere else that made me drop immediately. Thank you so much @shamblett for all your help and for this great library.

luohao123 commented 1 year ago

hello, my problem is same, it was caused by same client ID, but I can change client ID since every thing boundled with this ID.

And it's unique along with device, How can I check if the client IS REAL connnect or just offline but server side think it was online? (My client seems already stopped, but server still says it's connect)

Sawansb commented 8 months ago

Hello, I am encountering the same issue. When another user is logged in, it continues to connect to the broker and drops messages. Even though I am generating a random string and passing it as the clientId, it still presents the same issue. Has anyone found a solution?

luohao123 commented 8 months ago

No.