SSL Blynk example fails to re-connect

Hi Expert,

I am using a Wemos D1 mini. I uploaded the basic blynk blink sketch, uploaded and works fine in the app. Next, I thought I test the same with the SSL connection. I noticed the only difference is the BlynkSimpleEsp8266_SSL.h in the include section. I uploaded the new sketch, all works fine. After I reset, or reboot the device, it can never connect to the server again. If I re-upload the sketch it works again.
In the serial monitor, I can see that the board attempts to reconnect o the server with no success. These line come again and again:
[5001] Connecting to blynk-cloud.com:8442
[5077] Ready (ping: 1ms).

What does it mean? Wemos D1 mini is not good enough for SSL? Or this is just some weird bug?

Thanks,
Csongor

I might be mistaken here… haven’t played around with SSL enough… but I think SSL is more for use with Local Server, where you can have your own generated security certificates.

Meanwhile, for the Cloud Server, just use the library that worked.

Would you have any concern a 3rd party taking control of the device when not having a a secure connection between the device and the server?

Should I be concerned about this?

I use Local Server and generated certs (even though I actually have no need, as everything runs within my LAN for now)

As for you and whatever choice you make, i guess reading up about it might answer your questions… I searched the documentation for you…

http://docs.blynk.cc/#security

I think I have been there (documentation) in the past. I understand that there is more security with a local server, but to be honest the reason blynk appealed to me as it provides a cloud server so, I don’t need my own server for a light application.

Still, when I upload the SSL sketch, I noticed that ESP is still trying to connect on port 8442, even though documentation states that the secure port is 8441. So I replaced the standard Blynk.begin line with this:
Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8441);
I am seeing this in the serial console:

[133001] Connecting to blynk-cloud.com:8441
[133428] Certificate OK
[133465] Ready (ping: 1ms).
[133500] Connecting to blynk-cloud.com:8441
[133936] Certificate OK
[148504] Connecting to blynk-cloud.com:8441
[148927] Certificate OK
[148969] Ready (ping: 1ms).
[149004] Connecting to blynk-cloud.com:8441
[149426] Certificate OK
[164009] Connecting to blynk-cloud.com:8441
[164435] Certificate OK
[164471] Ready (ping: 1ms).
[164508] Connecting to blynk-cloud.com:8441
[164927] Certificate OK
[179509] Connecting to blynk-cloud.com:8441
[179950] Certificate OK
[179991] Ready (ping: 1ms).
[180027] Connecting to blynk-cloud.com:8441
[180453] Certificate OK

This keeps repeating forever.

Slightly more info. I uploaded the SSL sketch again, and the ESP can only connect after about 2 minutes. Here is the complete serial output:

[258] Connecting to xxxx
[5759] Connected to WiFi
[5759] IP: 192.168.1.114
[5759]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/ v0.4.7 on Arduino

[5829] Connecting to blynk-cloud.com:8441
[6332] Certificate OK
[6368] Ready (ping: 0ms).
[6406] Connecting to blynk-cloud.com:8441
[6830] Certificate OK
[21407] Connecting to blynk-cloud.com:8441
[21829] Certificate OK
[21866] Ready (ping: 1ms).
[21902] Connecting to blynk-cloud.com:8441
[22325] Certificate OK
[36941] Connecting to blynk-cloud.com:8441
[37368] Certificate OK
[37406] Ready (ping: 1ms).
[37442] Connecting to blynk-cloud.com:8441
[37866] Certificate OK
[52446] Connecting to blynk-cloud.com:8441
[52868] Certificate OK
[52905] Ready (ping: 1ms).
[52942] Connecting to blynk-cloud.com:8441
[53370] Certificate OK
[67944] Connecting to blynk-cloud.com:8441
[68365] Certificate OK
[68402] Ready (ping: 1ms).
[68437] Connecting to blynk-cloud.com:8441
[68864] Certificate OK
[83440] Connecting to blynk-cloud.com:8441
[83861] Certificate OK
[83896] Ready (ping: 0ms).
[83932] Connecting to blynk-cloud.com:8441
[84360] Certificate OK
[98936] Connecting to blynk-cloud.com:8441
[99356] Certificate OK
[99393] Ready (ping: 1ms).
[99430] Connecting to blynk-cloud.com:8441
[99856] Certificate OK
[114433] Connecting to blynk-cloud.com:8441
[114856] Certificate OK
[114893] Ready (ping: 1ms).
[114937] Connecting to blynk-cloud.com:8441
[115362] Certificate OK
[129937] Connecting to blynk-cloud.com:8441
[130361] Certificate OK
[130399] Ready (ping: 1ms).

After this I have reset the ESP. About 30 minutes has passed, it is still trying to connect without much luck:

[1541710] Connecting to blynk-cloud.com:8441
[1542138] Certificate OK

Is this still the case when using port 8441?

Perhaps the issue is in the Wemos firmware? I am afraid I don’t know enough about ESP8266 firmware to suggest much more.

Yes, the issue is the same with port 8441.

Maybe it makes sense not to show SSL in the example builder for 8266 based boards if it is not working reliably.

@Csongor_Varga are you including the relevant parts in your sketch i.e. #include <BlynkSimpleEsp8266_SSL.h> rather than #include <BlynkSimpleEsp8266.h> and the appropriate finger / thumbprint?

SSL does push the ESP to it’s extremes so don’t try building a moon lander with it.

As stated in the documents, it’s more a platform issue.

Having the SSL option is also for those who want to use Local Server for total security - Note that Local Server is not a big investment requirement, you can easily run it on a $10 RPi Zero WiFi

So, until a developer or someone else with Wemos & Cloud Server via SSL experiance chips in with another idea, I suggest you just use the regular library that most others do… haven’t heard of hackers taking over someone’s Blynkified toaster yet :wink:

Ah, looks like someone did whilst I was typing… :+1:

Thanks guys. Yes, I was using the correct library.

I know RPi Zero is not a huge investment, but it is another device which needs to be maintained, and can have issues on its own. I also have a RPi at home running Node-Red which would be my preferred platform if I am having my own server.

But as you said, I should keep is simple and not to build a moon lander with it.

I found that having the BLYNK.CONNECTED() function messes up with SSL. If you have it in your sketch, try removing it and see if it helps.

Also, always use the latest library version