Comments (5)
Hola Javier,
this is not a CTBot library issue, anyway I'll try to help you.
I guess you don't update the ESP8266 core for some compatibility issue versus old code, but I strongly suggest you to update.
BTW the core of the CTBot library is the sendCommand()
method: it is "self contained". In other word that method:
- establish a connection to the Telegram Server
- send the defined command
- get the response
There are a lot of other stuff inside (for example, exit when the JSON packet is complete without waiting the connection timeout) so my advice is: try to use the code in thesendCommand()
method stripping out all the fancy code.
As far as I remember, the fingerprint is mandatory only from 2.5.0 ESP8266 core library version and above, so I guess is not a fingerprint problem...
Finally, try to use this code to create the WiFiClientSecure object:
BearSSL::WiFiClientSecure telegramServer;
and in your setup, set the fingerprint:
telegramServer.setFingerprint(m_fingerprint);
My last advice is, when you can't figure out what is going wrong, put some console log (Serial.print()
) printing out the returned codes of the functions/methods called as you can monitor if errors occurred.
Let me know if you found a solution.
Mucha suerte hombre y que te vaya bien!
Stefano
from ctbot.
Hola Stefano!! gracias por tu respuesta! CTbot es una biblioteca estupenda! =)
Yes is true it is not a library error! sorry! but I was so interested to know how the library CTbot works so that it still works in version 2.4.2. For reasons of library compatibility, I cannot update the version of core 2.4.2.
if I understood correctly, at the beginning of the sketch I have to write: const uint8_t fingerprint[20] = { 0xBB, 0xDC, 0x45, 0x2A, 0x07, 0xE3, 0x4A, 0x71, 0x33, 0x40, 0x32, 0xDA, 0xBE, 0x81, 0xF7, 0x72, 0x6F, 0x4A, 0x2B, 0x6B }; and BearSSL::WiFiClientSecure telegramServer;
then in the setup block: telegramServer.setFingerprint(m_fingerprint); but i have a question where does this variable "m_fingerprint" come from?
grazie per il tuo aiuto!!=)
from ctbot.
ehm... copy/paste error :-D
As you said:
- In the beginning of the sketch (global variables)
const uint8_t fingerprint[20] = { 0xBB, 0xDC, 0x45, 0x2A, 0x07, 0xE3, 0x4A, 0x71, 0x33, 0x40, 0x32, 0xDA, 0xBE, 0x81, 0xF7, 0x72, 0x6F, 0x4A, 0x2B, 0x6B };
BearSSL::WiFiClientSecure telegramServer;
- In the setup block:
telegramServer.setFingerprint(fingerprint);
Try and let me know ;-)
Stefano
from ctbot.
Stefano, now it works but in the first cycle, that is, the first connection to the api.telegram.org server works and can send the first message! but then when performing the same action again "Connection 149.154.167.198:443... Connection to the server failed!" what would be the problem?
from ctbot.
Javier, I see in your first posted code a lot of client.connect()
but you don't close any connections.
The error that pop out is likely a connection issue due an already established connection.
My advice is to build up a procedure that do:
- connect to the telegram server
- send the command passed as paraeter when call the procedure
- read the telegram response
- close the connection
Let the CTBot library sendCommand()
method inspire you ;-)
Stefano
from ctbot.
Related Issues (20)
- possible to act on only the last received message? HOT 2
- Send messages from bot without user interaction HOT 6
- reconnection when internet is restored HOT 1
- Error regarding the TBMessage data type
- kernel panic with getNewMessage() HOT 2
- Ctbot no found HOT 1
- Using platformIO esp8266 panics every few seconds and reboots. HOT 7
- sendMessage not work HOT 4
- connecting to bot ? bit HOT 3
- Error when setting TBMessage as parameter HOT 1
- wrong result of testConnection() (sometimes) HOT 17
- failed connect to telegram HOT 17
- Telegram not responding HOT 1
- Message not send at bot telegram why? HOT 1
- Exception soft WDT Reset HOT 3
- Compile issues. HOT 2
- fingerprint for telegram HOT 24
- Long connect time on esp8266
- Problem with ESP.reset() HOT 4
- Why my bot get messages starting with 't'? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ctbot.