shamblett / mqtt_client

A server and browser based MQTT client for dart
Other
552 stars 179 forks source link

Fatal client disconnect when messages are sent too close to each other #340

Closed debungle-it closed 2 years ago

debungle-it commented 2 years ago

My flutter app is sending status information to an MQTT server on Azure.

If the updates are about a second apart, all goes well. If they get mre frequenet, the clinet disconnects and I get a flutter exception.

Below is the pertinent code to establish the connection, the data event loop and the debug logs. /// Initialization

client.useWebSocket = false; client.port = 8883; client.autoReconnect = true; client.keepAlivePeriod = 3600;

client.secure = true; client.setProtocolV311();

final connMess = MqttConnectMessage() .withClientIdentifier(clientIdentifier) .startClean(); // Non persistent session for testing debugPrint('+++Pedal Stream 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 will /// never send malformed messages. /// password = await mqttGetToken(); try { await client.connect( user, password ); }

//// data event loop

I/flutter ( 6089): +++OnConnected client callback - Client connection was successful I/flutter ( 6089): +++:mqtt client connected I/flutter ( 6089): +++++ Adding payload: {"sessionId" : "1234567" , "participantId": "12345" , "timestamp" : "2021-12-01 01:41:01.587504Z" , "currentSpeed" : "12.123" , "currentPower" : "29.3"} I/flutter ( 6089): +++::Publishing our message I/flutter ( 6089): 1-2021-11-30 17:41:01.659261 -- PublishingManager::publish - entered with topic devices//messages/events/ I/flutter ( 6089): 1-2021-11-30 17:41:01.682122 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.publish I/flutter ( 6089): Header: MessageType = MqttMessageType.publish, Duplicate = false, Retain = false, Qos = MqttQos.exactlyOnce, Size = 0 I/flutter ( 6089): Publish Variable Header: TopicName={devices//messages/events/}, MessageIdentifier={1}, VH Length={0} I/flutter ( 6089): Payload: {152 bytes={<123><34><115><101><115><115><105><111><110><73><100><34><32><58><32><34><49><50><51><52><53><54><55><34><32><44><32><34><112><97><114><116><105><99><105><112><97><110><116><73><100><34><58><32><34><49><50><51><52><53><34><32><44><32><34><116><105><109><101><115><116><97><109><112><34><32><58><32><34><50><48><50><49><45><49><50><45><48><49><32><48><49><58><52><49><58><48><49><46><53><56><55><53><48><52><90><34><32><44><32><34><99><117><114><114><101><110><116><83><112><101><101><100><34><32><58><32><34><49><50><46><49><50><51><34><32><44><32><34><99><117><114><114><101><110><116><80><111><119><101><114><34><32><58><32><34><50><57><46><51><34><125> I/flutter ( 6089): messageId: 1 I/flutter ( 6089): +++::Sleeping.... I/flutter ( 6089): 1-2021-11-30 17:41:02.140066 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 6089): 1-2021-11-30 17:41:02.158502 -- MqttConnectionHandlerBase::autoReconnect entered I/flutter ( 6089): 1-2021-11-30 17:41:02.165133 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection I/flutter ( 6089): 1-2021-11-30 17:41:02.169524 -- MqttConnectionHandlerBase::connect - server mqttQueue.azure-devices.net, port 8883 I/flutter ( 6089): 1-2021-11-30 17:41:02.170917 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter ( 6089): 1-2021-11-30 17:41:02.171868 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true I/flutter ( 6089): 1-2021-11-30 17:41:02.172521 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto I/flutter ( 6089): 1-2021-11-30 17:41:02.182255 -- MqttSecureConnection::connectAuto - entered I/flutter ( 6089): 1-2021-11-30 17:41:04.159465 -- MqttSecureConnection::connectAuto - securing socket I/flutter ( 6089): 1-2021-11-30 17:41:04.161126 -- MqttSecureConnection::connectAuto - start listening I/flutter ( 6089): 1-2021-11-30 17:41:04.163079 -- MqttServerConnection::_startListening I/flutter ( 6089): 1-2021-11-30 17:41:04.166721 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 1-2021-11-30 17:41:04.168320 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 1-2021-11-30 17:41:04.169746 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 1-2021-11-30 17:41:04.187284 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 1-2021-11-30 17:41:04.445487 -- MqttConnection::_onData I/flutter ( 6089): 1-2021-11-30 17:41:04.449756 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 6089): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 6089): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 6089): 1-2021-11-30 17:41:04.458997 -- MqttServerConnection::_onData - message available event fired I/flutter ( 6089): 1-2021-11-30 17:41:04.461445 -- MqttConnectionHandlerBase::_connectAckProcessor I/flutter ( 6089): 1-2021-11-30 17:41:04.462829 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected I/flutter ( 6089): +++OnConnected client callback - Client connection was successful I/flutter ( 6089): 1-2021-11-30 17:41:04.465843 -- MqttConnectionHandlerBase:: cancelling connect timer I/flutter ( 6089): 1-2021-11-30 17:41:04.468404 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 6089): 1-2021-11-30 17:41:04.469887 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 6089): 1-2021-11-30 17:41:04.475459 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete I/flutter ( 6089): 1-2021-11-30 17:41:04.482943 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true I/flutter ( 6089): +++:mqtt client connected I/flutter ( 6089): +++++ Adding payload: {"sessionId" : "1234567" , "participantId": "12345" , "timestamp" : "2021-12-01 01:41:08.416632Z" , "currentSpeed" : "12.123" , "currentPower" : "29.3"} I/flutter ( 6089): +++::Publishing our message I/flutter ( 6089): 1-2021-11-30 17:41:08.420144 -- PublishingManager::publish - entered with topic devices//messages/events/ I/flutter ( 6089): 1-2021-11-30 17:41:08.421228 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.publish I/flutter ( 6089): Header: MessageType = MqttMessageType.publish, Duplicate = false, Retain = false, Qos = MqttQos.exactlyOnce, Size = 0 I/flutter ( 6089): Publish Variable Header: TopicName={devices//messages/events/}, MessageIdentifier={2}, VH Length={0} I/flutter ( 6089): Payload: {152 bytes={<123><34><115><101><115><115><105><111><110><73><100><34><32><58><32><34><49><50><51><52><53><54><55><34><32><44><32><34><112><97><114><116><105><99><105><112><97><110><116><73><100><34><58><32><34><49><50><51><52><53><34><32><44><32><34><116><105><109><101><115><116><97><109><112><34><32><58><32><34><50><48><50><49><45><49><50><45><48><49><32><48><49><58><52><49><58><48><56><46><52><49><54><54><51><50><90><34><32><44><32><34><99><117><114><114><101><110><116><83><112><101><101><100><34><32><58><32><34><49><50><46><49><50><51><34><32><44><32><34><99><117><114><114><101><110><116><80><111><119><101><114><34><32><58><32><34><50><57><46><51><34><125> I/flutter ( 6089): messageId: 2 I/flutter ( 6089): +++::Sleeping.... I/flutter ( 6089): +++:mqtt client connected I/flutter ( 6089): +++++ Adding payload: {"sessionId" : "1234567" , "participantId": "12345" , "timestamp" : "2021-12-01 01:41:08.597366Z" , "currentSpeed" : "12.123" , "currentPower" : "29.3"} I/flutter ( 6089): +++::Publishing our message I/flutter ( 6089): 1-2021-11-30 17:41:08.600170 -- PublishingManager::publish - entered with topic devices//messages/events/ I/flutter ( 6089): 1-2021-11-30 17:41:08.601274 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.publish I/flutter ( 6089): Header: MessageType = MqttMessageType.publish, Duplicate = false, Retain = false, Qos = MqttQos.exactlyOnce, Size = 0 I/flutter ( 6089): Publish Variable Header: TopicName={devices//messages/events/}, MessageIdentifier={3}, VH Length={0} I/flutter ( 6089): Payload: {152 bytes={<123><34><115><101><115><115><105><111><110><73><100><34><32><58><32><34><49><50><51><52><53><54><55><34><32><44><32><34><112><97><114><116><105><99><105><112><97><110><116><73><100><34><58><32><34><49><50><51><52><53><34><32><44><32><34><116><105><109><101><115><116><97><109><112><34><32><58><32><34><50><48><50><49><45><49><50><45><48><49><32><48><49><58><52><49><58><48><56><46><53><57><55><51><54><54><90><34><32><44><32><34><99><117><114><114><101><110><116><83><112><101><101><100><34><32><58><32><34><49><50><46><49><50><51><34><32><44><32><34><99><117><114><114><101><110><116><80><111><119><101><114><34><32><58><32><34><50><57><46><51><34><125> I/flutter ( 6089): messageId: 3 I/flutter ( 6089): +++::Sleeping.... I/flutter ( 6089): +++:mqtt client connected I/flutter ( 6089): +++++ Adding payload: {"sessionId" : "1234567" , "participantId": "12345" , "timestamp" : "2021-12-01 01:41:08.813427Z" , "currentSpeed" : "12.123" , "currentPower" : "29.3"} I/flutter ( 6089): +++::Publishing our message I/flutter ( 6089): 1-2021-11-30 17:41:08.818870 -- PublishingManager::publish - entered with topic devices//messages/events/ I/flutter ( 6089): 1-2021-11-30 17:41:08.819937 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.publish I/flutter ( 6089): Header: MessageType = MqttMessageType.publish, Duplicate = false, Retain = false, Qos = MqttQos.exactlyOnce, Size = 0 I/flutter ( 6089): Publish Variable Header: TopicName={devices//messages/events/}, MessageIdentifier={4}, VH Length={0} I/flutter ( 6089): Payload: {152 bytes={<123><34><115><101><115><115><105><111><110><73><100><34><32><58><32><34><49><50><51><52><53><54><55><34><32><44><32><34><112><97><114><116><105><99><105><112><97><110><116><73><100><34><58><32><34><49><50><51><52><53><34><32><44><32><34><116><105><109><101><115><116><97><109><112><34><32><58><32><34><50><48><50><49><45><49><50><45><48><49><32><48><49><58><52><49><58><48><56><46><56><49><51><52><50><55><90><34><32><44><32><34><99><117><114><114><101><110><116><83><112><101><101><100><34><32><58><32><34><49><50><46><49><50><51><34><32><44><32><34><99><117><114><114><101><110><116><80><111><119><101><114><34><32><58><32><34><50><57><46><51><34><125> I/flutter ( 6089): messageId: 4 I/flutter ( 6089): +++::Sleeping.... I/flutter ( 6089): 1-2021-11-30 17:41:08.879273 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 6089): 1-2021-11-30 17:41:08.880637 -- MqttConnectionHandlerBase::autoReconnect entered I/flutter ( 6089): 1-2021-11-30 17:41:08.882316 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection I/flutter ( 6089): 1-2021-11-30 17:41:08.883351 -- MqttConnectionHandlerBase::connect - server mqttQueue.azure-devices.net, port 8883 I/flutter ( 6089): 1-2021-11-30 17:41:08.884614 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter ( 6089): 1-2021-11-30 17:41:08.885828 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true I/flutter ( 6089): 1-2021-11-30 17:41:08.886932 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto I/flutter ( 6089): 1-2021-11-30 17:41:08.888136 -- MqttSecureConnection::connectAuto - entered I/flutter ( 6089): ---EXCEPTION: ERROR mqtt client connection failed - disconnecting, status is Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 1-2021-11-30 17:41:09.006312 -- MqttConnectionHandlerBase::disconnect - entered I/flutter ( 6089): 1-2021-11-30 17:41:09.008855 -- MqttConnectionHandlerBase::_performConnectionDisconnect entered I/flutter ( 6089): 1-2021-11-30 17:41:09.023791 -- MqttConnectionKeepAlive::stop - stopping keep alive I/flutter ( 6089): +++::OnDisconnected client callback - Client disconnection I/flutter ( 6089): +++OnDisconnected callback is solicited, this is correct I/flutter ( 6089): ---EXCEPTION:: --- reconnecting.... I/flutter ( 6089): 2-2021-11-30 17:41:09.036975 -- Authenticating with username '....' and password '....' I/flutter ( 6089): 2-2021-11-30 17:41:09.037655 -- MqttClient::checkCredentials - Username length (38) exceeds the max recommended in the MQTT spec. I/flutter ( 6089): 2-2021-11-30 17:41:09.038417 -- MqttClient::checkCredentials - Password length (146) exceeds the max recommended in the MQTT spec. I/flutter ( 6089): 2-2021-11-30 17:41:09.040071 -- MqttClient::connect - keep alive is enabled with a value of 3600 seconds I/flutter ( 6089): 2-2021-11-30 17:41:09.041135 -- MqttConnectionKeepAlive:: Initialised with a keep alive value of 3600 seconds I/flutter ( 6089): 2-2021-11-30 17:41:09.041859 -- MqttConnectionKeepAlive:: Disconnect on no ping response is disabled I/flutter ( 6089): 2-2021-11-30 17:41:09.043046 -- MqttConnectionHandlerBase::connect - server mqttQueue.azure-devices.net, port 8883 I/flutter ( 6089): 2-2021-11-30 17:41:09.044182 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter ( 6089): 2-2021-11-30 17:41:09.045259 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress false I/flutter ( 6089): 2-2021-11-30 17:41:09.046046 -- SynchronousMqttServerConnectionHandler::internalConnect - secure selected I/flutter ( 6089): 2-2021-11-30 17:41:09.046960 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect I/flutter ( 6089): 2-2021-11-30 17:41:09.047591 -- MqttSecureConnection::connect - entered I/flutter ( 6089): ---EXCEPTION: ERROR mqtt client connection failed - disconnecting, status is Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 2-2021-11-30 17:41:09.207488 -- MqttConnectionHandlerBase::disconnect - entered I/flutter ( 6089): 2-2021-11-30 17:41:09.208776 -- MqttConnectionHandlerBase::_performConnectionDisconnect entered I/flutter ( 6089): 2-2021-11-30 17:41:09.210631 -- MqttConnectionKeepAlive::stop - stopping keep alive I/flutter ( 6089): +++::OnDisconnected client callback - Client disconnection I/flutter ( 6089): +++OnDisconnected callback is solicited, this is correct I/flutter ( 6089): ---EXCEPTION:: --- reconnecting.... I/flutter ( 6089): 3-2021-11-30 17:41:09.215785 -- Authenticating with username '....' and password '....' I/flutter ( 6089): 3-2021-11-30 17:41:09.216502 -- MqttClient::checkCredentials - Username length (38) exceeds the max recommended in the MQTT spec. I/flutter ( 6089): 3-2021-11-30 17:41:09.217250 -- MqttClient::checkCredentials - Password length (146) exceeds the max recommended in the MQTT spec. I/flutter ( 6089): 3-2021-11-30 17:41:09.221715 -- MqttClient::connect - keep alive is enabled with a value of 3600 seconds I/flutter ( 6089): 3-2021-11-30 17:41:09.224346 -- MqttConnectionKeepAlive:: Initialised with a keep alive value of 3600 seconds I/flutter ( 6089): 3-2021-11-30 17:41:09.224897 -- MqttConnectionKeepAlive:: Disconnect on no ping response is disabled I/flutter ( 6089): 3-2021-11-30 17:41:09.225779 -- MqttConnectionHandlerBase::connect - server mqttQueue.azure-devices.net, port 8883 I/flutter ( 6089): 3-2021-11-30 17:41:09.226416 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter ( 6089): 3-2021-11-30 17:41:09.227175 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress false I/flutter ( 6089): 3-2021-11-30 17:41:09.227867 -- SynchronousMqttServerConnectionHandler::internalConnect - secure selected I/flutter ( 6089): 3-2021-11-30 17:41:09.228600 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect I/flutter ( 6089): 3-2021-11-30 17:41:09.229701 -- MqttSecureConnection::connect - entered I/flutter ( 6089): ---EXCEPTION: ERROR mqtt client connection failed - disconnecting, status is Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 3-2021-11-30 17:41:09.379045 -- MqttConnectionHandlerBase::disconnect - entered I/flutter ( 6089): 3-2021-11-30 17:41:09.379961 -- MqttConnectionHandlerBase::_performConnectionDisconnect entered I/flutter ( 6089): 3-2021-11-30 17:41:09.381265 -- MqttConnectionKeepAlive::stop - stopping keep alive I/flutter ( 6089): +++::OnDisconnected client callback - Client disconnection I/flutter ( 6089): +++OnDisconnected callback is solicited, this is correct I/flutter ( 6089): ---EXCEPTION:: --- reconnecting.... I/flutter ( 6089): 4-2021-11-30 17:41:09.386962 -- Authenticating with username '....' and password '....' I/flutter ( 6089): 4-2021-11-30 17:41:09.387934 -- MqttClient::checkCredentials - Username length (38) exceeds the max recommended in the MQTT spec. I/flutter ( 6089): 4-2021-11-30 17:41:09.389145 -- MqttClient::checkCredentials - Password length (146) exceeds the max recommended in the MQTT spec. I/flutter ( 6089): 4-2021-11-30 17:41:09.391029 -- MqttClient::connect - keep alive is enabled with a value of 3600 seconds I/flutter ( 6089): 4-2021-11-30 17:41:09.392467 -- MqttConnectionKeepAlive:: Initialised with a keep alive value of 3600 seconds I/flutter ( 6089): 4-2021-11-30 17:41:09.393197 -- MqttConnectionKeepAlive:: Disconnect on no ping response is disabled I/flutter ( 6089): 4-2021-11-30 17:41:09.394111 -- MqttConnectionHandlerBase::connect - server mqttQueue.azure-devices.net, port 8883 I/flutter ( 6089): 4-2021-11-30 17:41:09.394784 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter ( 6089): 4-2021-11-30 17:41:09.395633 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress false I/flutter ( 6089): 4-2021-11-30 17:41:09.396329 -- SynchronousMqttServerConnectionHandler::internalConnect - secure selected I/flutter ( 6089): 4-2021-11-30 17:41:09.397524 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect I/flutter ( 6089): 4-2021-11-30 17:41:09.398198 -- MqttSecureConnection::connect - entered I/flutter ( 6089): 4-2021-11-30 17:41:09.803543 -- MqttSecureConnection::connectAuto - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:09.804214 -- MqttSecureConnection::connectAuto - start listening I/flutter ( 6089): 4-2021-11-30 17:41:09.804834 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:09.806140 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:09.806936 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:09.808125 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:09.809376 -- MqttConnectionHandlerBase::sendMessage - not connected I/flutter ( 6089): 4-2021-11-30 17:41:09.810502 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is disconnected with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:09.999316 -- MqttSecureConnection::connect - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:09.999961 -- MqttSecureConnection::connect - start listening I/flutter ( 6089): 4-2021-11-30 17:41:10.000781 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:10.003632 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:10.005223 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:10.006724 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:10.009131 -- MqttConnectionHandlerBase::sendMessage - not connected I/flutter ( 6089): 4-2021-11-30 17:41:10.010719 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is disconnected with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:10.028699 -- MqttSecureConnection::connect - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:10.029454 -- MqttSecureConnection::connect - start listening I/flutter ( 6089): 4-2021-11-30 17:41:10.030077 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:10.031240 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:10.031967 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:10.032480 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:10.033274 -- MqttConnectionHandlerBase::sendMessage - not connected I/flutter ( 6089): 4-2021-11-30 17:41:10.033953 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is disconnected with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:10.229380 -- MqttSecureConnection::connect - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:10.230020 -- MqttSecureConnection::connect - start listening I/flutter ( 6089): 4-2021-11-30 17:41:10.230602 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:10.232361 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:10.233293 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:10.234173 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:10.241828 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:10.496476 -- MqttConnection::_onData I/flutter ( 6089): 4-2021-11-30 17:41:10.497598 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 6089): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 6089): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 6089): 4-2021-11-30 17:41:10.499452 -- MqttServerConnection::_onData - message available event fired I/flutter ( 6089): 4-2021-11-30 17:41:10.502156 -- MqttConnectionHandlerBase::_connectAckProcessor I/flutter ( 6089): 4-2021-11-30 17:41:10.502809 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected I/flutter ( 6089): +++OnConnected client callback - Client connection was successful I/flutter ( 6089): 4-2021-11-30 17:41:10.504370 -- MqttConnectionHandlerBase:: cancelling connect timer I/flutter ( 6089): 4-2021-11-30 17:41:10.505819 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:10.506622 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 6089): +++::Sleeping.... I/flutter ( 6089): 4-2021-11-30 17:41:14.831989 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is disconnected with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:14.835557 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 1, auto reconnect in progress true I/flutter ( 6089): 4-2021-11-30 17:41:14.837625 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto I/flutter ( 6089): 4-2021-11-30 17:41:14.839219 -- MqttSecureConnection::connectAuto - entered I/flutter ( 6089): 4-2021-11-30 17:41:15.015012 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is disconnected with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:15.019014 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 1, auto reconnect in progress false I/flutter ( 6089): 4-2021-11-30 17:41:15.020359 -- SynchronousMqttServerConnectionHandler::internalConnect - secure selected I/flutter ( 6089): 4-2021-11-30 17:41:15.021691 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect I/flutter ( 6089): 4-2021-11-30 17:41:15.023049 -- MqttSecureConnection::connect - entered I/flutter ( 6089): 4-2021-11-30 17:41:15.045172 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is disconnected with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:15.046254 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 1, auto reconnect in progress false I/flutter ( 6089): 4-2021-11-30 17:41:15.047126 -- SynchronousMqttServerConnectionHandler::internalConnect - secure selected I/flutter ( 6089): 4-2021-11-30 17:41:15.048119 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect I/flutter ( 6089): 4-2021-11-30 17:41:15.049208 -- MqttSecureConnection::connect - entered I/flutter ( 6089): 4-2021-11-30 17:41:15.850156 -- MqttSecureConnection::connectAuto - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:15.851120 -- MqttSecureConnection::connectAuto - start listening I/flutter ( 6089): 4-2021-11-30 17:41:15.852376 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:15.854413 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:15.855619 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:15.856767 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:15.867397 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:15.883274 -- MqttSecureConnection::connect - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:15.883995 -- MqttSecureConnection::connect - start listening I/flutter ( 6089): 4-2021-11-30 17:41:15.884870 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:15.887262 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:15.888455 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:15.889385 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:15.895169 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:16.079397 -- MqttSecureConnection::connect - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:16.080806 -- MqttSecureConnection::connect - start listening I/flutter ( 6089): 4-2021-11-30 17:41:16.082253 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:16.085038 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:16.086420 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:16.087818 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:16.097043 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:16.115667 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 6089): 4-2021-11-30 17:41:16.117467 -- MqttConnectionHandlerBase::autoReconnect entered I/flutter ( 6089): 4-2021-11-30 17:41:16.118095 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection I/flutter ( 6089): 4-2021-11-30 17:41:16.118968 -- MqttConnectionHandlerBase::connect - server mqttQueue.azure-devices.net, port 8883 I/flutter ( 6089): 4-2021-11-30 17:41:16.119692 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter ( 6089): 4-2021-11-30 17:41:16.120321 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true I/flutter ( 6089): 4-2021-11-30 17:41:16.121052 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto I/flutter ( 6089): 4-2021-11-30 17:41:16.121745 -- MqttSecureConnection::connectAuto - entered I/flutter ( 6089): 4-2021-11-30 17:41:16.139891 -- MqttConnection::_onData I/flutter ( 6089): 4-2021-11-30 17:41:16.140933 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 6089): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 6089): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 6089): 4-2021-11-30 17:41:16.141863 -- MqttServerConnection::_onData - WARN - message available event not fired, event bus is closed I/flutter ( 6089): 4-2021-11-30 17:41:16.154359 -- MqttConnection::_onData I/flutter ( 6089): 4-2021-11-30 17:41:16.155428 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 6089): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 6089): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 6089): 4-2021-11-30 17:41:16.156130 -- MqttServerConnection::_onData - WARN - message available event not fired, event bus is closed I/flutter ( 6089): 4-2021-11-30 17:41:16.347924 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 6089): 4-2021-11-30 17:41:16.351754 -- MqttClient::internalDisconnect - not invoking auto connect, already in progress I/flutter ( 6089): 4-2021-11-30 17:41:16.378485 -- MqttConnection::_onData I/flutter ( 6089): 4-2021-11-30 17:41:16.379481 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 6089): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 6089): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 6089): 4-2021-11-30 17:41:16.380909 -- MqttServerConnection::_onData - WARN - message available event not fired, event bus is closed I/flutter ( 6089): 4-2021-11-30 17:41:16.876966 -- MqttSecureConnection::connectAuto - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:16.879166 -- MqttSecureConnection::connectAuto - start listening I/flutter ( 6089): 4-2021-11-30 17:41:16.880782 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:16.884858 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:16.886405 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:16.887829 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:16.895738 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:17.150244 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 6089): 4-2021-11-30 17:41:17.152950 -- MqttClient::internalDisconnect - not invoking auto connect, already in progress I/flutter ( 6089): 4-2021-11-30 17:41:17.173714 -- MqttConnection::_onData I/flutter ( 6089): 4-2021-11-30 17:41:17.175400 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 6089): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 6089): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 6089): 4-2021-11-30 17:41:17.177194 -- MqttServerConnection::_onData - message available event fired I/flutter ( 6089): 4-2021-11-30 17:41:17.179531 -- MqttConnectionHandlerBase::_connectAckProcessor I/flutter ( 6089): 4-2021-11-30 17:41:17.180756 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected I/flutter ( 6089): +++OnConnected client callback - Client connection was successful I/flutter ( 6089): 4-2021-11-30 17:41:17.183374 -- MqttConnectionHandlerBase:: cancelling connect timer I/flutter ( 6089): 4-2021-11-30 17:41:17.185481 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:17.186606 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:17.188344 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete I/flutter ( 6089): 4-2021-11-30 17:41:17.190135 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true I/flutter ( 6089): 4-2021-11-30 17:41:20.875869 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:20.882094 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 2, auto reconnect in progress true I/flutter ( 6089): 4-2021-11-30 17:41:20.885604 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto I/flutter ( 6089): 4-2021-11-30 17:41:20.887081 -- MqttSecureConnection::connectAuto - entered I/flutter ( 6089): 4-2021-11-30 17:41:20.900231 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:20.902363 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 2, auto reconnect in progress false I/flutter ( 6089): 4-2021-11-30 17:41:20.903631 -- SynchronousMqttServerConnectionHandler::internalConnect - secure selected I/flutter ( 6089): 4-2021-11-30 17:41:20.904684 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect I/flutter ( 6089): 4-2021-11-30 17:41:20.905888 -- MqttSecureConnection::connect - entered I/flutter ( 6089): 4-2021-11-30 17:41:21.101496 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:21.104167 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 2, auto reconnect in progress false I/flutter ( 6089): 4-2021-11-30 17:41:21.105721 -- SynchronousMqttServerConnectionHandler::internalConnect - secure selected I/flutter ( 6089): 4-2021-11-30 17:41:21.106954 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect I/flutter ( 6089): 4-2021-11-30 17:41:21.108173 -- MqttSecureConnection::connect - entered I/flutter ( 6089): 4-2021-11-30 17:41:21.650838 -- MqttSecureConnection::connectAuto - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:21.651445 -- MqttSecureConnection::connectAuto - start listening I/flutter ( 6089): 4-2021-11-30 17:41:21.652191 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:21.653321 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:21.653869 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:21.654562 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:21.660406 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:21.687519 -- MqttSecureConnection::connect - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:21.688169 -- MqttSecureConnection::connect - start listening I/flutter ( 6089): 4-2021-11-30 17:41:21.689024 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:21.690780 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:21.691830 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:21.692776 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:21.698478 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:21.855237 -- MqttSecureConnection::connect - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:21.856004 -- MqttSecureConnection::connect - start listening I/flutter ( 6089): 4-2021-11-30 17:41:21.856876 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:21.859004 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:21.860125 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:21.861362 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:21.871919 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:21.905791 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 6089): 4-2021-11-30 17:41:21.908166 -- MqttConnectionHandlerBase::autoReconnect entered I/flutter ( 6089): 4-2021-11-30 17:41:21.908961 -- MqttConnectionHandlerBase::autoReconnect - attempting reconnection I/flutter ( 6089): 4-2021-11-30 17:41:21.909650 -- MqttConnectionHandlerBase::connect - server mqttQueue.azure-devices.net, port 8883 I/flutter ( 6089): 4-2021-11-30 17:41:21.910397 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter ( 6089): 4-2021-11-30 17:41:21.911147 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress true I/flutter ( 6089): 4-2021-11-30 17:41:21.911838 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connectAuto I/flutter ( 6089): 4-2021-11-30 17:41:21.912561 -- MqttSecureConnection::connectAuto - entered I/flutter ( 6089): 4-2021-11-30 17:41:21.928968 -- MqttConnection::_onData I/flutter ( 6089): 4-2021-11-30 17:41:21.930140 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 6089): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 6089): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 6089): 4-2021-11-30 17:41:21.931447 -- MqttServerConnection::_onData - WARN - message available event not fired, event bus is closed I/flutter ( 6089): 4-2021-11-30 17:41:21.950937 -- MqttConnection::_onData I/flutter ( 6089): 4-2021-11-30 17:41:21.951986 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 6089): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 6089): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 6089): 4-2021-11-30 17:41:21.953350 -- MqttServerConnection::_onData - WARN - message available event not fired, event bus is closed I/flutter ( 6089): 4-2021-11-30 17:41:22.118632 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 6089): 4-2021-11-30 17:41:22.121755 -- MqttClient::internalDisconnect - not invoking auto connect, already in progress I/flutter ( 6089): 4-2021-11-30 17:41:22.140277 -- MqttConnection::_onData I/flutter ( 6089): 4-2021-11-30 17:41:22.142529 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 6089): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 6089): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 6089): 4-2021-11-30 17:41:22.143991 -- MqttServerConnection::_onData - WARN - message available event not fired, event bus is closed I/flutter ( 6089): 4-2021-11-30 17:41:22.659673 -- MqttSecureConnection::connectAuto - securing socket I/flutter ( 6089): 4-2021-11-30 17:41:22.660925 -- MqttSecureConnection::connectAuto - start listening I/flutter ( 6089): 4-2021-11-30 17:41:22.662582 -- MqttServerConnection::_startListening I/flutter ( 6089): 4-2021-11-30 17:41:22.666779 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter ( 6089): 4-2021-11-30 17:41:22.670762 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter ( 6089): 4-2021-11-30 17:41:22.673297 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter ( 6089): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 210 I/flutter ( 6089): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=true, WillFlag=false, WillQos=MqttQos.atMostOnce, WillRetain=false, PasswordFlag=true, UserNameFlag=true, KeepAlive=3600 I/flutter ( 6089): MqttConnectPayload - client identifier is : I/flutter ( 6089): 4-2021-11-30 17:41:22.682127 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:22.933817 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 6089): 4-2021-11-30 17:41:22.938108 -- MqttClient::internalDisconnect - not invoking auto connect, already in progress I/flutter ( 6089): 4-2021-11-30 17:41:22.960388 -- MqttConnection::_onData I/flutter ( 6089): 4-2021-11-30 17:41:22.962292 -- MqttServerConnection::_onData - message received MQTTMessage of type MqttMessageType.connectAck I/flutter ( 6089): Header: MessageType = MqttMessageType.connectAck, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 2 I/flutter ( 6089): Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={MqttConnectReturnCode.connectionAccepted} I/flutter ( 6089): 4-2021-11-30 17:41:22.964381 -- MqttServerConnection::_onData - message available event fired I/flutter ( 6089): 4-2021-11-30 17:41:22.967297 -- MqttConnectionHandlerBase::_connectAckProcessor I/flutter ( 6089): 4-2021-11-30 17:41:22.968652 -- MqttConnectionHandlerBase:_connectAckProcessor - state = connected I/flutter ( 6089): +++OnConnected client callback - Client connection was successful I/flutter ( 6089): 4-2021-11-30 17:41:22.971235 -- MqttConnectionHandlerBase:: cancelling connect timer I/flutter ( 6089): 4-2021-11-30 17:41:22.973158 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:22.974175 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connected with return code of connectionAccepted and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:22.975612 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect complete I/flutter ( 6089): 4-2021-11-30 17:41:22.977215 -- Subscriptionsmanager::_resubscribe - resubscribing from auto reconnect true I/flutter ( 6089): 4-2021-11-30 17:41:26.667880 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:26.669708 -- SynchronousMqttServerConnectionHandler::internalConnect exited with state Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:26.671319 -- MqttConnectionHandlerBase::autoReconnect - auto reconnect failed - re trying E/flutter ( 6089): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Bad state: Cannot add new events after calling close E/flutter ( 6089): #0 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:243:24) E/flutter ( 6089): #1 EventBus.fire (package:event_bus/event_bus.dart:61:22) E/flutter ( 6089): #2 MqttConnectionHandlerBase.autoReconnect (package:mqtt_client/src/connectionhandling/mqtt_client_mqtt_connection_handler_base.dart:155:23) E/flutter ( 6089): E/flutter ( 6089): I/flutter ( 6089): 4-2021-11-30 17:41:26.709466 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:26.710771 -- SynchronousMqttServerConnectionHandler::internalConnect failed I/flutter ( 6089): ---EXCEPTION::client exception - mqtt-client::NoConnectionException: The maximum allowed connection attempts ({3}) were exceeded. The broker is not responding to the connection request message (Missing Connection Acknowledgement? I/flutter ( 6089): 4-2021-11-30 17:41:26.730188 -- MqttConnectionHandlerBase::disconnect - entered I/flutter ( 6089): 4-2021-11-30 17:41:26.733226 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.disconnect I/flutter ( 6089): Header: MessageType = MqttMessageType.disconnect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter ( 6089): 4-2021-11-30 17:41:26.739112 -- MqttConnectionHandlerBase::_performConnectionDisconnect entered I/flutter ( 6089): 4-2021-11-30 17:41:26.740506 -- MqttConnectionKeepAlive::stop - stopping keep alive I/flutter ( 6089): +++::OnDisconnected client callback - Client disconnection I/flutter ( 6089): +++OnDisconnected callback is solicited, this is correct I/flutter ( 6089): +++::Sleeping.... I/flutter ( 6089): 4-2021-11-30 17:41:26.874787 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter ( 6089): 4-2021-11-30 17:41:26.875645 -- SynchronousMqttServerConnectionHandler::internalConnect failed I/flutter ( 6089): ---EXCEPTION::client exception - mqtt-client::NoConnectionException: The maximum allowed connection attempts ({3}) were exceeded. The broker is not responding to the connection request message (Missing Connection Acknowledgement? I/flutter ( 6089): +++::OnDisconnected client callback - Client disconnection I/flutter ( 6089): +++OnDisconnected callback is solicited, this is correct I/flutter ( 6089): +++::Sleeping.... I/flutter ( 6089): 4-2021-11-30 17:42:09.713363 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 6089): 4-2021-11-30 17:42:09.715098 -- MqttClient::internalDisconnect - not invoking disconnect, no connection handler I/flutter ( 6089): 4-2021-11-30 17:42:09.728690 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter ( 6089): 4-2021-11-30 17:42:09.729985 -- MqttClient::internalDisconnect - not invoking disconnect, no connection handler

shamblett commented 2 years ago

I'm not sure why you think the client disconnects, this line from the top of the log -

I/flutter ( 6089): 1-2021-11-30 17:41:02.140066 -- MqttConnectionBase::_onDone - calling disconnected callback

shows the client is being disconnected from Azure, this is the onDone callback from the flutter/Dart socket layer which is just propagated to the client. You need to tie this up with your Azure log to see what reason Azure is logging for this.

debungle-it commented 2 years ago

Setting the message quality of service to atLeastOnce did the trick.

messageIdentifier = client.publishMessage( pubTopic, MqttQos.atLeastOnce, builder.payload!, retain: true);