Universal-Arduino-Telegram-Bot: Longpoll - non blocking version
My ESP will receive no more than 5 or 6 commands from Telegram in 24 hours, but in such a case, I need a fast response, action and notification.
I have some doubt about using Longpoll. Who can give me Pros & Cons on Longpoll? In addition, would Long poll in some way delay the execution of other commands in the loop?
I am asking this question because I have noticed that when I set longPoll = 60, my device does not answer anymore to OTA, due to a timeout.
bot.longPoll = 60;
void loop() {
server.handleClient();
ArduinoOTA.handle();
timeClient.update();
if (millis() > Bot_lasttime + Bot_mtbs) {
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
while (numNewMessages) {
handleNewMessages(numNewMessages);
numNewMessages = bot.getUpdates(bot.last_message_received + 1);
}
Bot_lasttime = millis();
}
}
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 28 (2 by maintainers)
@witnessmenow Brian, is there a chance to embed this mod into the latest library update? The library is generating 25GB of traffic/month with LongPoll=0 and I need to use a non-blocking LongPoll.