-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP8266 blocks when using TLS and tries to publish disconnected from broker #78
Comments
That's weird. Somehow the client does not properly switch into the disconnected state. I suspect a bug in the underlying In the meantime: Can you ensure you have the latest Arduino, ESP8266-Core, and arduino-mqtt library versions installed and if not test again? |
I have checked and I have the latest versions. |
Hi Joël, Have you been able to test yourself where the problem is? |
I just released v2.2.0 (might take some time to appear in the library manager). Can you check this again with the latest version? |
I will try it this week and I tell you if the problem has been solved. Thank you |
Hi Joël, I have been doing several test and I can confirm that the main issue has been solved. |
If you have a silent mqtt connection (no incoming and outgoing messages), the client will send ping packets to test if the connection is still alive. So, if you disconnect the internet connection as you described, it may take some time until the WiFi stack emits an error because of the graceful tcp keep alive. That's why you experience a delay until the client detects a disconnection. On top of that, the client uses command timeouts internally. By default any network action has a timeout of 1 sec, which means that the network read/write command can take up to that amount of time to complete. That probably causes the hangs in your code. Both systems can be configure using On top of that, I might also be that the ESP8266 WiFi system has more timeouts and delays I'm not aware of. |
Thank you for your response Joël. |
Sorry for leaving this issue stale. The |
hello @martinren87 & @256dpi So my problem is only in publishing I tried with changing in " keepAlive and timeout" and with WiFi to mobile hotspot but the problem is same as it is |
I'm closing this as the ESP8266 project switched to a new TLS library and made many improvements to the network stack that probably automatically fixed this issue by now. |
Hello Joël,
I am using the library for a project where I need to connect my ESP8266 to a private broker through a secure connection.
I discovered that when my internet connection was working, everything was fine, but when my internet connection failed (the ESP8266 was connected to WIFI, but there was no internet available) the device stopped responding.
After a lot of tests, i came to the conclusion that the problem was only if I used a secure connection.
I copy an example code so you can test it:
The way I tested was generating a Wifi network with my mobile phone, and sharing my mobile data connection. As soon as I turn off the mobile data transmission, the ESP8266 stops writing on the serial port.
If you do the same test but not using a secure connection, everything works fine:
WiFiClientSecure net;
replaced byWiFiClient net;
client.begin("myserver.com", 8883, net);
replaced byclient.begin("myserver.com", 1883, net);
Am I doing something wrong??
The text was updated successfully, but these errors were encountered: