Dependency Used: mqtt_client
Error: disconnecting automatically right after the connection is established
Log:
I/flutter (24905): 2-2025-01-29 07:31:40.215640 -- Authenticating with username '{diyusthad}' and password '{raspberry}'
I/flutter (24905): 2-2025-01-29 07:31:40.219568 -- MqttClient::connect - Connection timeout period is 5000 milliseconds
I/flutter (24905): 2-2025-01-29 07:31:40.220388 -- MqttClient::connect - keep alive is enabled with a value of 20 seconds
I/flutter (24905): 2-2025-01-29 07:31:40.220833 -- MqttConnectionKeepAlive:: Initialised with a keep alive value of 20 seconds
I/flutter (24905): 2-2025-01-29 07:31:40.221026 -- MqttConnectionKeepAlive:: Disconnect on no ping response is disabled
I/flutter (24905): 2-2025-01-29 07:31:40.221286 -- MqttConnectionHandlerBase::connect - server 192.168.1.3, port 1883
I/flutter (24905): 2-2025-01-29 07:31:40.221490 -- SynchronousMqttServerConnectionHandler::internalConnect entered
I/flutter (24905): 2-2025-01-29 07:31:40.221640 -- SynchronousMqttServerConnectionHandler::internalConnect - initiating connection try 0, auto reconnect in progress false
I/flutter (24905): 2-2025-01-29 07:31:40.221790 -- SynchronousMqttServerConnectionHandler::internalConnect - insecure TCP selected
I/flutter (24905): 2-2025-01-29 07:31:40.221956 -- SynchronousMqttServerConnectionHandler::internalConnect - calling connect
I/flutter (24905): 2-2025-01-29 07:31:40.222095 -- MqttNormalConnection::connect - entered
I/flutter (24905): 2-2025-01-29 07:31:42.540151 -- MqttConnectionBase::_onError - calling disconnected callback
I/flutter (24905): MqttConnectionState.faulted
Solution: Change the client.setProtocolV311()
client.setProtocolV311()
to client.setProtocolV31()
client.setProtocolV31()
fixes the problem

In this project, we are going to make an Android app with flutter which will communicate with Arduino via USB serial to read the data from the HC-SR04 ultrasonic module and to display the output as a measurement in centimeters. Concept The Arduino will take the raw data from the…
In "Arduino"

IoT Plant Monitor project we are going to use the Seeed Studios' new XIAO ESP32C development board to read moisture sensor data and send it to our application via WebSocket. Concept The concept is to run a WebSocket server in XIAO ESP32C which will read and calibrate the data from…
In "Arduino"

What is Heroku? Heroku is a cloud platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud. It is a fully-managed platform that takes care of all the infrastructure, security, and maintenance required to run an application, allowing developers to focus on…
In "ESP32"