Hardware init connecting to blynk server takes long time

everytime I startup my nodemcu device, it will take long time to connect to blynk server like below:

[5225] Connecting to BII
[9227] Connected to WiFi
[9227] IP: 192.168.0.111
[9227] Blynk v0.3.8 on ESP-12
[9227] Connecting to blynk-cloud.com:8442
[14228] Connecting to blynk-cloud.com:8442
[19229] Connecting to blynk-cloud.com:8442
[24230] Connecting to blynk-cloud.com:8442
[29231] Connecting to blynk-cloud.com:8442
[34232] Connecting to blynk-cloud.com:8442
[39233] Connecting to blynk-cloud.com:8442
[44234] Connecting to blynk-cloud.com:8442
[49235] Connecting to blynk-cloud.com:8442
[54236] Connecting to blynk-cloud.com:8442
[59237] Connecting to blynk-cloud.com:8442
[64238] Connecting to blynk-cloud.com:8442
[69239] Connecting to blynk-cloud.com:8442
[74240] Connecting to blynk-cloud.com:8442
[79241] Connecting to blynk-cloud.com:8442
[84242] Connecting to blynk-cloud.com:8442
[89243] Connecting to blynk-cloud.com:8442
[94244] Connecting to blynk-cloud.com:8442
[99245] Connecting to blynk-cloud.com:8442
[104246] Connecting to blynk-cloud.com:8442
[109247] Connecting to blynk-cloud.com:8442
[114248] Connecting to blynk-cloud.com:8442
[119249] Connecting to blynk-cloud.com:8442
[124250] Connecting to blynk-cloud.com:8442
[129251] Connecting to blynk-cloud.com:8442
[134252] Connecting to blynk-cloud.com:8442
[139253] Connecting to blynk-cloud.com:8442
[139870] Ready (ping: 0ms).

almost 2 mins or longer. Is this normal?
here my basic code:

#define BLYNK_PRINT Serial  
#include 
#include 

#define PIN 2

char auth[] = "94f3c4e9470xxx";

char ssid[] = "xxxx";
char pass[] = "xxx";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}

void loop()
{
  Blynk.run();
}

Thanks.

@rocklulu 2 seconds is about the norm, not 2 minutes.

my nodemcu device join wifi network takes about 2s, but connect to blynk server really takes at least 2mins.

my wifi network state to blynk-cloud.com, not too bad:

C:\Users\Rock>ping blynk-cloud.com -t

Pinging blynk-cloud.com [188.166.177.186] with 32 bytes of data:
Reply from 188.166.177.186: bytes=32 time=264ms TTL=40
Reply from 188.166.177.186: bytes=32 time=275ms TTL=40
Reply from 188.166.177.186: bytes=32 time=276ms TTL=40
Reply from 188.166.177.186: bytes=32 time=276ms TTL=40
Reply from 188.166.177.186: bytes=32 time=383ms TTL=40
...

yes I’m sure it’s my network problem :pensive:

In Europe your time of around 275ms is generally about 60ms but I wouldn’t have thought that was your problem.

You are now the third Blynker that has experienced problems with that IP (see Error connecting to Blynk. Re-enter Blynk auth token and Issue on Cloud Blynk Server).

As per my post to @noersaleh you really should wait to be connected, even though Blynk.run() will keep trying. So try adding this after Blynk.begin():

  while (!Blynk.connect()) { 
     //Wait until connected
  } 

You could move on later to something like this after Blynk.begin():

int mytimeout = millis() / 1000;    
while (Blynk.connect(3000) == false) {  // try for 9.99 seconds
      if((millis() / 1000) > mytimeout + 8){ // try for less than 9 seconds
        break;                    // blynk.run() will kep trying to connect
      }
}

@Dmitriy I and others have experienced problems with individually sync’s pins on connection to Blynk.

syncAll seems to be ok but I very rarely use that but when several pins are sync’d it casuses problems. A workaround is to delay some of the sync’s but it is not ideal.

Do you know how many pins a regular ESP can safely sync and are you able to do a server side fix i.e. delay between pin sync’s?

@Costas Thank you for pointing out. I have created similar issue - https://github.com/blynkkk/blynk-library/issues/179 few days ago. For @vshymanskyy. This look like library issue and not server.

1 Like

I am having the same issue it take too long to connect to server like 2 minutes.

here is the debug info

[    1200] Getting IP...
[8458] IP:192.168.1.122
[8458] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on Arduino Uno

[8576] Connecting to blynk-cloud.com:80
[40833] Connecting to blynk-cloud.com:80
[73039] Connecting to blynk-cloud.com:80
[105247] Connecting to blynk-cloud.com:80
[137454] Connecting to blynk-cloud.com:80
[169661] Connecting to blynk-cloud.com:80
[201869] Connecting to blynk-cloud.com:80
[202169] Ready (ping: 115ms).

@arslan43711 this is a 6 year old topic, and many things have changed in the world of Blynk since then.

I’d suggest that you start a new “Need help with my project” topic, and provide ALL of the information that is requested when you do that, including following the instructions about how to correctly format your sketch when you post it.

Pete.