witnessmenow / Universal-Arduino-Telegram-Bot

Use Telegram on your Arduino (ESP8266 or Wifi-101 boards)
MIT License
1.12k stars 307 forks source link

Problem: GET Update Messages #126

Closed jriquelmeit closed 5 years ago

jriquelmeit commented 5 years ago

hi, i using the example to documentation. i have following problem

GET Update Messages [BOT]Connecting to server [BOT]Conection error Received empty string in response! leer mensaje 0

The fragment code is:

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>

*
*
*
void loop() {
    if (millis() > Bot_lasttime + Bot_mtbs)  {
        Serial.println("leer mensaje");
        int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
        Serial.println("leer mensaje");
        Serial.println(numNewMessages);
        while(numNewMessages) {
            Serial.println("got response");
            for (int i=0; i<numNewMessages; i++) {
                bot.sendMessage(bot.messages[i].chat_id, bot.messages[i].text, "");
            }
            numNewMessages = bot.getUpdates(bot.last_message_received + 1);
        }
        Bot_lasttime = millis();
    }
}
jriquelmeit commented 5 years ago

I have solved the problem with following change replace WiFiClientSecure client with BearSSL::WiFiClientSecure client and add line client.setInsecure();