My project is based on a custom "bare-bone" style Arduino and based on an ATMEGA1284. The custom board doesn't support simply plugging in a shield. I am therefore trying to use an ESP-01 module and the (excellent!) WiFiEsp library.
After much debugging, I have tracked the problem to the establishing of the connection itself. I have duplicated the problem completely without any Arduino code by typing the commands manually into SerialMonitor with an ESP-01 module plugged into a USB adapter.
When issuing AT+CIPSTART=3,"SSL","www.google.com",443 I almost immediately receive 3,CONNECT followed by OK.
When issuing AT+CIPSTART=3,"SSL","api.telegram.org",443 I almost immediately receive 3,CLOSED followed by OK. (Immediate = about 40 milliseconds according to the SerialMonitor timestamps)
Subsequent AT+CIPSEND works fine on Google but receives some "link is not valid" message for api.telegram.org, presumably because the connection was not properly established.
I have no idea if the ESP-01 has chosen to close the connection for some reason or if api.telegram.org closed (or refused) the connection.
I don't think the problem is with the ESP-01 or firmware. I have several modules with various firmware (the latest is 1.5) and they all behave identical. I really don't want to reflash the module which is why I haven't moved to the WiFiEspAT library (though I am enviously eyeing some of the additional functionality it provides!).
If anyone has an idea why the connection doesn't go through, I would be most grateful. I would also greatly appreciate any tips anyone may have as to how I could investigate the problem further. So far, telegram support hasn't answered my inquiry.