Closed OpenJarvisAI closed 6 months ago
Oh, I change to test.mosquiito.org server, still got same error:
_client =
// MqttServerClient.withPort(host, cid, 1883, maxConnectionAttempts: 3);
MqttServerClient.withPort("test.mosquitto.org", cid, 1883, maxConnectionAttempts: 3);
49356 -- MqttConnectionHandlerBase::sendMessage - sending message ended >>>
I/flutter (20758): 2023-11-20 22:49:22.549656 -- MqttSynchronousServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of notAuthorized and a disconnection origin of none
I/flutter (20758): 2023-11-20 22:49:22.896146 -- MqttServerConnection::_onData - Message Received Started <<<
I/flutter (20758): 2023-11-20 22:49:22.896568 -- MqttServerConnection::_ondata - adding incoming data, data length is 5, message stream length is 0, message stream position is 0
I/flutter (20758): 2023-11-20 22:49:22.896904 -- MqttServerConnection::_ondata - added incoming data message stream length is 5, message stream position is 0
I/flutter (20758): 2023-11-20 22:49:22.897433 -- MqttByteBuffer:isMessageAvailable - assumed valid header, value is 32
I/flutter (20758): 2023-11-20 22:49:22.898125 -- MqttServerConnection::_onData - MESSAGE RECEIVED -> MQTTMessage of type MqttMessageType.connectAck
I/flutter (20758): MessageType = MqttMessageType.connectAck Duplicate = false Retain = false Qos = atMostOnce Size = 3
I/flutter (20758): Session Present = false
I/flutter (20758): Connect Reason Code = notAuthorized
I/flutter (20758): Session Expiry Interval = 0
I/flutter (20758): Receive Maximum = 65535
I/flutter (20758): Maximum QoS = 2
I/flutter (20758): Retain Available = false
I/flutter (20758): Maximum Packet Size = 0
I/flutter (20758): Assigned client Identifier = null
I/flutter (20758): Topic Alias Maximum = 0
I/flutter (20758): Reason String = null
I/flutter (20758): Wildcard Subscription Available = true
I/flutter (20758): Subscription Identifiers Available = true
I/flutter (20758): Shared Subscription Available = true
I/flutter (20758): broker Keep Alive = 0
I/flutter (20758): Response Information = null
I/flutter (20758): broker Reference = null
I/flutter (20758): Authentication Method = null
I/flutter (20758): Properties = No properties set
I/flutter (20758): 2023-11-20 22:49:22.899004 -- MqttServerConnection::_onData - message available event fired
I/flutter (20758): 2023-11-20 22:49:22.899375 -- MqttServerConnection::_onData - Message Received Ended <<<
I/flutter (20758): 2023-11-20 22:49:22.900013 -- MqttConnectionHandlerBase::_connectAckProcessor
I/flutter (20758): 2023-11-20 22:49:22.900401 -- MqttConnectionHandlerBase::_connectAckProcessor connection rejected, reason code is notAuthorized
I/flutter (20758): 2023-11-20 22:49:22.900911 -- MqttConnectionHandlerBase::_performConnectionDisconnect entered
I/flutter (20758): 2023-11-20 22:49:22.901248 -- MqttConnectionHandlerBase:: cancelling connect timer
I/flutter (20758): 2023-11-20 22:49:22.902776 -- MqttConnectionBase::_onDone - calling disconnected callback
I/flutter (20758): 2023-11-20 22:49:22.903424 -- MqttSynchronousServerConnectionHandler::internalConnect - post sleep, state = Connection status is disconnected with return code of notAuthorized and a disconnection origin of none
I/flutter (20758): 2023-11-20 22:49:22.903661 -- MqttSynchronousServerConnectionHandler::internalConnect failed
I/flutter (20758): [KLOG] Exception: mqtt-client::NoConnectionException: The maximum allowed connection attempts ({3}) were exceeded. The broker is not responding to the connection request message correctly The reason code is notAuthorized
I am using 1883 port, apparently this port is not authoried.
The not authorized reason code is nothing to do with the port, why did you think that? Not authorized means your username or password or both are wrong, please read the MQTT5 spec.
Hi, this is my code:
Now, the connection ends up 3 maxium failure connection, then disconnected.
Every try tells my different reason:
Can anyone tell me why this happen?