shamblett / mqtt_client

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

. The broker is not responding to the connection request message (Missing Connection Acknowledgement #301

Closed rany1225 closed 3 years ago

rany1225 commented 3 years ago

When connecting securely, (client.secure = true), Certificate type is ca signed server ,how should I set the property to receive Connection Acknowledgement

shamblett commented 3 years ago

Not sure what you mean, the connack message is sent by the broker when you send the connect message as part of the connect process. Are you saying this is not happening? please post a log output.

rany1225 commented 3 years ago

2021-07-19 16:40:04.082 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.081888 -- MqttConnectionHandlerBase::connect - server psp-sit138.harix.iamidata.com, port 20197 2021-07-19 16:40:04.086 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.086568 -- SynchronousMqttServerConnectionHandler::internalConnect entered 2021-07-19 16:40:04.086 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.086828 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress false 2021-07-19 16:40:04.087 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.087155 -- SynchronousMqttServerConnectionHandler::internalConnect - insecure TCP selected 2021-07-19 16:40:04.087 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.087699 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect 2021-07-19 16:40:04.088 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.088460 -- MqttNormalConnection::connect - entered 2021-07-19 16:40:04.358 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.357563 -- MqttServerConnection::_startListening 2021-07-19 16:40:04.363 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.363050 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete 2021-07-19 16:40:04.363 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.363687 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message 2021-07-19 16:40:04.372 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.372075 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 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=60 MqttConnectPayload - client identifier is : mqttx_813c8b44 2021-07-19 16:40:04.397 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.397114 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 16:40:04.525 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:04.525217 -- MqttConnectionBase::_onDone - calling disconnected callback 2021-07-19 16:40:09.407 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:09.407097 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 16:40:09.409 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:09.408736 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 1, auto reconnect in progress false 2021-07-19 16:40:09.409 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:09.409216 -- SynchronousMqttServerConnectionHandler::internalConnect - insecure TCP selected 2021-07-19 16:40:09.409 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:09.409550 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect 2021-07-19 16:40:09.410 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:09.409890 -- MqttNormalConnection::connect - entered 2021-07-19 16:40:09.561 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:09.560680 -- MqttServerConnection::_startListening 2021-07-19 16:40:09.562 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:09.562182 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete 2021-07-19 16:40:09.562 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:09.562662 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message 2021-07-19 16:40:09.563 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:09.563289 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 49 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=60 MqttConnectPayload - client identifier is : mqttx_813c8b44 2021-07-19 16:40:09.569 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:09.568726 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 16:40:09.687 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:09.687024 -- MqttConnectionBase::_onDone - calling disconnected callback 2021-07-19 16:40:14.572 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.572155 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 16:40:14.572 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.572528 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 2, auto reconnect in progress false 2021-07-19 16:40:14.572 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.572644 -- SynchronousMqttServerConnectionHandler::internalConnect - insecure TCP selected 2021-07-19 16:40:14.572 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.572756 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect 2021-07-19 16:40:14.572 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.572882 -- MqttNormalConnection::connect - entered 2021-07-19 16:40:14.663 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.663644 -- MqttServerConnection::_startListening 2021-07-19 16:40:14.664 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.664024 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete 2021-07-19 16:40:14.664 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.664101 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message 2021-07-19 16:40:14.664 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.664221 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 49 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=60 MqttConnectPayload - client identifier is : mqttx_813c8b44 2021-07-19 16:40:14.665 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.665226 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 16:40:14.732 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.732536 -- MqttConnectionBase::_onDone - calling disconnected callback 2021-07-19 16:40:19.672 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:19.672210 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 16:40:19.673 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:19.673294 -- SynchronousMqttServerConnectionHandler::internalConnect failed 2021-07-19 16:40:19.689 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: MobilePSP e — — — — — — — — — — — — — — — — st — — — — — — — — — — — — — — — — 2021-07-19 16:40:19.689 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: MobilePSP e | MQTT_PATROL---> mqtt 服务连接失败 err mqtt-client::NoConnectionException: The maximum allowed connection attempts ({3}) were exceede 2021-07-19 16:40:19.689 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: MobilePSP e | d. The broker is not responding to the connection request message (Missing Connection Acknowledgement?

rany1225 commented 3 years ago

http://tools.emqx.io/ This tool can test mqtt online. There are two types of Certificate, one of which is ca signed server. The certificate is on the server side and the client does not need it

shamblett commented 3 years ago

I can confirm that your server psp-sit138.harix.iamidata.com, on port 20197 using client id mqttx_813c8b44 is not sending a connack message, you will need to look at your broker logs to find out why. Also you keep mentioning secure mode, the log output above is not using secure mode -

2021-07-19 16:40:14.572 17915-17979/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 16:40:14.572644 -- SynchronousMqttServerConnectionHandler::internalConnect - insecure TCP selected

its insecure.

rany1225 commented 3 years ago

sorry , That log is wrong。The following is the secure connection 2021-07-19 17:52:31.193 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.193517 -- MqttConnectionHandlerBase::connect - server psp-sit138.harix.iamidata.com, port 20197 2021-07-19 17:52:31.199 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.198961 -- SynchronousMqttServerConnectionHandler::internalConnect entered 2021-07-19 17:52:31.199 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.199307 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress false 2021-07-19 17:52:31.199 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.199655 -- SynchronousMqttServerConnectionHandler::internalConnect - secure selected 2021-07-19 17:52:31.200 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.200557 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect 2021-07-19 17:52:31.201 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.201782 -- MqttSecureConnection::connect - entered 2021-07-19 17:52:31.416 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.416137 -- MqttSecureConnection::connect - securing socket 2021-07-19 17:52:31.417 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.417702 -- MqttSecureConnection::connect - start listening 2021-07-19 17:52:31.418 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.418547 -- MqttServerConnection::_startListening 2021-07-19 17:52:31.420 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.420687 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete 2021-07-19 17:52:31.420 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.420784 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message 2021-07-19 17:52:31.424 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.424441 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 0 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=60 MqttConnectPayload - client identifier is : mqttx_813c8b44 2021-07-19 17:52:31.436 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.435906 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 17:52:36.446 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.446029 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 17:52:36.447 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.447562 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 1, auto reconnect in progress false 2021-07-19 17:52:36.448 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.447876 -- SynchronousMqttServerConnectionHandler::internalConnect - secure selected 2021-07-19 17:52:36.448 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.448164 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect 2021-07-19 17:52:36.448 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.448411 -- MqttSecureConnection::connect - entered 2021-07-19 17:52:36.474 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.474533 -- MqttConnectionBase::_onDone - calling disconnected callback 2021-07-19 17:52:36.617 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.617008 -- MqttSecureConnection::connect - securing socket 2021-07-19 17:52:36.617 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.617380 -- MqttSecureConnection::connect - start listening 2021-07-19 17:52:36.617 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.617489 -- MqttServerConnection::_startListening 2021-07-19 17:52:36.617 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.617883 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete 2021-07-19 17:52:36.618 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.618001 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message 2021-07-19 17:52:36.618 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.618293 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 49 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=60 MqttConnectPayload - client identifier is : mqttx_813c8b44 2021-07-19 17:52:36.619 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:36.619868 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 17:52:41.624 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.623886 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 17:52:41.624 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.624552 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 2, auto reconnect in progress false 2021-07-19 17:52:41.624 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.624798 -- SynchronousMqttServerConnectionHandler::internalConnect - secure selected 2021-07-19 17:52:41.625 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.625041 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect 2021-07-19 17:52:41.625 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.625253 -- MqttSecureConnection::connect - entered 2021-07-19 17:52:41.628 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.628625 -- MqttConnectionBase::_onDone - calling disconnected callback 2021-07-19 17:52:41.789 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.788813 -- MqttSecureConnection::connect - securing socket 2021-07-19 17:52:41.789 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.789224 -- MqttSecureConnection::connect - start listening 2021-07-19 17:52:41.789 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.789324 -- MqttServerConnection::_startListening 2021-07-19 17:52:41.789 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.789743 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete 2021-07-19 17:52:41.789 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.789848 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message 2021-07-19 17:52:41.790 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.790066 -- MqttConnectionHandlerBase::sendMessage - MQTTMessage of type MqttMessageType.connect Header: MessageType = MqttMessageType.connect, Duplicate = false, Retain = false, Qos = MqttQos.atMostOnce, Size = 49 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=60 MqttConnectPayload - client identifier is : mqttx_813c8b44 2021-07-19 17:52:41.791 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:41.791729 -- SynchronousMqttServerConnectionHandler::internalConnect - pre sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 17:52:46.798 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:46.797726 -- SynchronousMqttServerConnectionHandler::internalConnect - post sleep, state = Connection status is connecting with return code of noneSpecified and a disconnection origin of none 2021-07-19 17:52:46.798 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:46.798627 -- SynchronousMqttServerConnectionHandler::internalConnect failed 2021-07-19 17:52:46.821 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: MobilePSP e — — — — — — — — — — — — — — — — st — — — — — — — — — — — — — — — — 2021-07-19 17:52:46.821 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: MobilePSP e | MQTT_PATROL---> mqtt 服务连接失败 err mqtt-client::NoConnectionException: The maximum allowed connection attempts ({3}) were exceede 2021-07-19 17:52:46.821 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: MobilePSP e | d. The broker is not responding to the connection request message (Missing Connection Acknowledgement?

rany1225 commented 3 years ago

http://tools.emqx.io/ I use this tool to test on the web side, and use secure connection. Certificate selects ca signed server, which can successfully connect, but using mqtt_client 7.2.0 on the app side can not succeed

shamblett commented 3 years ago

I'm not sure its a certificate error, the socket itself is being secured OK and we are sending the connect message -

2021-07-19 17:52:31.416 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.416137 -- MqttSecureConnection::connect - securing socket
021-07-19 17:52:31.420 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.420687 -- SynchronousMqttServerConnectionHandler::internalConnect - connection complete
2021-07-19 17:52:31.420 9112-9141/com.flutterwidgetfirst.data_mobile_portal I/flutter: 1-2021-07-19 17:52:31.420784 -- SynchronousMqttServerConnectionHandler::internalConnect sending connect message

Its more like an MQTT protocol level error, make sure you are selecting the correct MQTT version your broker is expecting, also trim the connection message down to its basic level(if you are using your own that is), get rid of the Will stuff. Your only real recourse here is look in your broker logs to see why its rejecting the connect message, the client can't tell you this.

rany1225 commented 3 years ago

I don't know how to use it, so I have to give up。I can only use other ways to achieve it on android platform