Skip to content
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

Bot disconnects after few minutes #142

Open
noname453 opened this issue Jun 14, 2024 · 2 comments
Open

Bot disconnects after few minutes #142

noname453 opened this issue Jun 14, 2024 · 2 comments

Comments

@noname453
Copy link

I am using https://github.com/cotestatnt/AsyncTelegram2/blob/master/examples/lightBot/lightBot.ino to test my bot and everything works fine for few minutes, the led responds to my on/off commands, but than my serial monitor prints "Unable to connect to Telegram server" over and over again.
The device that I'm using is AI THINKER esp32-cam.
Looked at #13 which sounds similar, but I am using the example as-is, so my loop does have the line myBot.getNewMessage(msg).
Also tried to set https://github.com/cotestatnt/AsyncTelegram2/blob/main/src/AsyncTelegram2.h#L20 (FS_SUPPORT) to TRUE, but there is no extra output in my console, all I get is:

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1448
load:0x40078000,len:14844
ho 0 tail 12 room 4
load:0x40080400,len:4
load:0x40080404,len:3356
entry 0x4008059c

Starting TelegramBot...

Test Telegram connection... OK
Bot name: @esp32bot

Unable to connect to Telegram server

I've managed to find that the last line is the output of AsyncTelegram2::checkConnection, but this is as far as I could get.
Any suggestions?

@fmanthey
Copy link

fmanthey commented Jun 15, 2024

Facing a similar issue using echoBot_wifiNINA example code as is. Just inserted my Wifi credentials, telegram token & userid. I am using Arduino Nano 33 IoT as a platform.

Bot works fine for few minutes and echoes back all messages as expected, but then stops doing so. To figure out where it is hanging I set #define DEBUG_ENABLE 1 in AsyncTelegram2.h. It keeps trying to reconnect via AsyncTelegram2::checkConnection() but fails to do so.

20:10:17.170 -> Unable to connect to Telegram server
20:10:17.170 -> 348919 [AsyncTelegram2.cpp:64 reset()]	Restart Telegram connection
20:10:17.170 -> 
20:10:17.170 -> 348920 [AsyncTelegram2.cpp:22 checkConnection()]	Start handshaking...
20:10:27.193 -> 
20:10:27.193 -> 
20:10:27.193 -> Unable to connect to Telegram server
20:10:27.193 -> 358929 [AsyncTelegram2.cpp:64 reset()]	Restart Telegram connection
20:10:27.193 -> 
20:10:27.193 -> 358929 [AsyncTelegram2.cpp:22 checkConnection()]	Start handshaking...
20:10:37.197 -> 
20:10:37.197 -> 
20:10:37.197 -> Unable to connect to Telegram server
20:10:37.197 -> 368939 [AsyncTelegram2.cpp:64 reset()]	Restart Telegram connection
20:10:37.197 -> 
20:10:37.197 -> 368940 [AsyncTelegram2.cpp:22 checkConnection()]	Start handshaking...

Any idea what is going on/wrong here?

Thanks & best regards

@noname453
Copy link
Author

Enabled debugging as @fmanthey did, I also get this line in my log:

Mon Jun 17 17:02:08 2024 [AsyncTelegram2.cpp:199 getUpdates()] Connection closed from server
Mon Jun 17 17:02:09 2024 [AsyncTelegram2.cpp:22 checkConnection()] Start handshaking...

so it looks like the server closes the connection.
Does it have anything to do with the bot's settings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants