shamblett / mqtt_client

A server and browser based MQTT client for dart
Other
548 stars 176 forks source link

cannot connect to broker.mqtt-dashboard.com #395

Closed letisoft closed 2 years ago

letisoft commented 2 years ago

Hello,

I can connect to any broker but:

broker.mqtt-dashboard.com

_client = MQTT.MqttServerClient.withPort("broker.mqtt-dashboard.com",'',1883); _client!.setProtocolV311();

MQTT.MqttConnectMessage connMess = MQTT.MqttConnectMessage()
    .withClientIdentifier("FANS MANAGER")
    .withWillQos(MQTT.MqttQos.atLeastOnce);
_client!.connectionMessage = connMess;

_client!.connect(null, null)

Error:

mqtt-client::NoConnectionException: The maximum allowed connection attempts ({3}) were exceeded. The broker is not responding to the connection request message (Missing Connection Acknowledgement?

log:

I/flutter (27274): 1-2022-07-18 15:13:04.350492 -- MqttClient::connect - keep alive is enabled with a value of 30 seconds I/flutter (27274): 1-2022-07-18 15:13:04.360975 -- MqttConnectionKeepAlive:: Initialised with a keep alive value of 30 seconds I/flutter (27274): 1-2022-07-18 15:13:04.363536 -- MqttConnectionKeepAlive:: Disconnect on no ping response is disabled I/flutter (27274): 1-2022-07-18 15:13:04.369472 -- MqttConnectionHandlerBase::connect - server broker.mqtt-dashboard.com, port 1883 I/flutter (27274): 1-2022-07-18 15:13:04.375708 -- SynchronousMqttServerConnectionHandler::internalConnect entered I/flutter (27274): 1-2022-07-18 15:13:04.379296 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress false I/flutter (27274): 1-2022-07-18 15:13:04.381341 -- SynchronousMqttServerConnectionHandler::internalConnect - insecure TCP selected I/flutter (27274): 1-2022-07-18 15:13:04.384545 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect I/flutter (27274): 1-2022-07-18 15:13:04.388342 -- MqttNormalConnection::connect - entered I/flutter (27274): 1-2022-07-18 15:13:04.621348 -- MqttServerConnection::_startListening I/flutter (27274): 1-2022-07-18 15:13:04.629111 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter (27274): 1-2022-07-18 15:13:04.629661 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter (27274): 1-2022-07-18 15:13:04.630661 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter (27274): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 I/flutter (27274): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=false, WillFlag=false, WillQos=MqttQos.atLeastOnce, WillRetain=false, PasswordFlag=false, UserNameFlag=false, KeepAlive=30 I/flutter (27274): MqttConnectPayload - client identifier is : FANS MANAGER I/flutter (27274): 1-2022-07-18 15:13:04.656227 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter (27274): 1-2022-07-18 15:13:04.708949 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter (27274): 1-2022-07-18 15:13:09.673975 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter (27274): 1-2022-07-18 15:13:09.675855 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 1, auto reconnect in progress false I/flutter (27274): 1-2022-07-18 15:13:09.676389 -- SynchronousMqttServerConnectionHandler::internalConnect - insecure TCP selected I/flutter (27274): 1-2022-07-18 15:13:09.676782 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect I/flutter (27274): 1-2022-07-18 15:13:09.677107 -- MqttNormalConnection::connect - entered I/flutter (27274): 1-2022-07-18 15:13:09.756933 -- MqttServerConnection::_startListening I/flutter (27274): 1-2022-07-18 15:13:09.758472 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter (27274): 1-2022-07-18 15:13:09.759021 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter (27274): 1-2022-07-18 15:13:09.759430 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter (27274): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 24 I/flutter (27274): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=false, WillFlag=false, WillQos=MqttQos.atLeastOnce, WillRetain=false, PasswordFlag=false, UserNameFlag=false, KeepAlive=30 I/flutter (27274): MqttConnectPayload - client identifier is : FANS MANAGER I/flutter (27274): 1-2022-07-18 15:13:09.761943 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter (27274): 1-2022-07-18 15:13:09.808554 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter (27274): 1-2022-07-18 15:13:14.772691 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter (27274): 1-2022-07-18 15:13:14.773561 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 2, auto reconnect in progress false I/flutter (27274): 1-2022-07-18 15:13:14.774013 -- SynchronousMqttServerConnectionHandler::internalConnect - insecure TCP selected I/flutter (27274): 1-2022-07-18 15:13:14.774430 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect I/flutter (27274): 1-2022-07-18 15:13:14.774794 -- MqttNormalConnection::connect - entered I/flutter (27274): 1-2022-07-18 15:13:14.846120 -- MqttServerConnection::_startListening I/flutter (27274): 1-2022-07-18 15:13:14.847532 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete I/flutter (27274): 1-2022-07-18 15:13:14.847995 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message I/flutter (27274): 1-2022-07-18 15:13:14.848461 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect I/flutter (27274): Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 24 I/flutter (27274): Connect Variable Header: ProtocolName=MQTT, ProtocolVersion=4, ConnectFlags=Connect Flags: Reserved1=false, CleanStart=false, WillFlag=false, WillQos=MqttQos.atLeastOnce, WillRetain=false, PasswordFlag=false, UserNameFlag=false, KeepAlive=30 I/flutter (27274): MqttConnectPayload - client identifier is : FANS MANAGER I/flutter (27274): 1-2022-07-18 15:13:14.850896 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter (27274): 1-2022-07-18 15:13:14.895266 -- MqttConnectionBase::_onDone - calling disconnected callback I/flutter (27274): 1-2022-07-18 15:13:19.862315 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none I/flutter (27274): 1-2022-07-18 15:13:19.863915 -- SynchronousMqttServerConnectionHandler::internalConnect failed

any ideas?

Thanks!

shamblett commented 2 years ago

Your not getting a con ack message, the broker is closing your connection immediately on reception of the connect message -

/flutter (27274): 1-2022-07-18 15:13:04.708949 -- MqttConnectionBase::_onDone - calling disconnected callback

Check your brokers logs. Try removing the will QoS.

letisoft commented 2 years ago

Hello,

Thank you very much for the fats response. I will check, meanwhile using the mqtt5 version of the plugin made it work.