AsyncTelegram2 icon indicating copy to clipboard operation
AsyncTelegram2 copied to clipboard

AsyncTelegram2 hangs the uC, when "unable to connect to server"

Open miguelfernando55 opened this issue 2 years ago • 8 comments

When it is not connected to the server, the uC hangs. It also should be async.

miguelfernando55 avatar Aug 09 '23 12:08 miguelfernando55

Hi @miguelfernando55 . Which microcontroller is it?

cotestatnt avatar Aug 09 '23 12:08 cotestatnt

esp32-s2-saola. Here what it is happenning image When it is unable, it delays the normal functionality of the rest of the system. As you may check in the image, I have an interval to send new info. When it happens "unable ... ", it is much longer

miguelfernando55 avatar Aug 09 '23 13:08 miguelfernando55

Thanks for your feedback, I will try to check after 20th August because I am going on vacation from next weekend

cotestatnt avatar Aug 09 '23 13:08 cotestatnt

Ok. Nice holidays. Hope you may upgrade the functionality.

miguelfernando55 avatar Aug 09 '23 13:08 miguelfernando55

Is it able to use a flag that warns when the "unable to connect to server" happens? Or does bool checkConnection(); is enough?

It would be good if we could question the telegram server if he is able to start a connection. Before really starting one.

miguelfernando55 avatar Aug 10 '23 08:08 miguelfernando55

Hi @miguelfernando55 Regarding your issue, it is not clear to me if the failed connection to the Telegram server happens even if the esp32 is correctly connected to the internet.

If you don't have an active internet connection, you should avoid calling the getNewMessage() method (and more generally the other library methods) because an attempt to connect to the server will still be made and this step is blocking (you can set a timeout eventually).

Checking the internet connection cannot be "internal" to the library because it is strictly linked to the hardware interface (WiFi, Ethernet, GPRS etctec).

cotestatnt avatar Aug 21 '23 13:08 cotestatnt

You are right. The esp32 may be connected to the router, but the router lost internet connection. It was because of this situation that the "unable to ...." happenned. I am blocking and not able to design a way to avoid this situation.

miguelfernando55 avatar Aug 21 '23 18:08 miguelfernando55

Are you able to provide me a status variable when the connection is hanging?

miguelfernando55 avatar Aug 22 '23 08:08 miguelfernando55