BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER or Blynk.connect()?

Just an explanation for a detail that I did not find an explanation for:

I saw that someone uses () in the Loop while others use Blynk.connect () in Setup.
In the documentation I did not find a clear explanation of the difference in practical terms of these two calls. All my sketches work properly without Blynk.connect () in the setup but with () in the Loop. Thanks to those who give me this info.

Come on! how can it be? Blynk’s docs aren’t 100% complete, but regarding those basics everything is there:

From myself I can add, that Blynk.connect() is the preferred (for me, at least) method for establishing connection with Blynk server.

1 Like

do not understand me wrong … :slight_smile:
it’s all 100% written but I do not understand.

favorite so I think “alternative”?

I do not believe. From what I understand Blynk.connect() starts the connection to the server and returns the connection status (true if connected, false if disconnected). At this point could also be not inserted in the loop? And viceversa? Does even manage to start the connection to the server as well as manage all the processes between devices, servers and apps? It would seem so since I have never used Blynk.connect() but only

But I do believe you are using Blynk.begin(), which I’m not.

So we do have:

  • Blynk.config () - for setting the connection details,
  • Blynk.connect() - for establishing connection,
  • Blynk.connected() - for checking the connection to server
  • - for managing Blynk “stuff”. If Blynk.connect WAS NOT called earlier, it tries to connect as well.
  • Blynk.begin() - blocking function which does the following: Establishes network connection, sets up Blynk connection details, and TRIES to connect to Blynk server… Till the end of the world, if it can’t reach the server.

Yes, instead of Blynk.begin()

1 Like

to add to the confusion. After lots of reading and testing I ended up with this core ‘connection’ setup:

BlynkTimer timer;

void reconnectBlynk() {
  if (!Blynk.connected()) {
    Serial.println("Lost connection");
    if(Blynk.connect()) {
    else {
      Serial.println("Not reconnected");

void setup() {
  Blynk.begin(auth, ssid, password, server, port);
  while (Blynk.connect() == false) {  }   // Wait until connected
  timer.setInterval(60 * 1000, reconnectBlynk);  // check every minute if still connected to server

void loop() {; 
  if(Blynk.connected()) {; }

note is completely borrowed from several contributors on this forum!

1 Like

@Franchelli re: or Blynk.connect()?

You are not comparing apples to apples here… is an essential housekeeping command that keeps the background library “running”.

Blynk.connect() is an optional command that, used in conjunction with other connection management commands, can allow purposeful disconnection and reconnection to the server, along with semi or automatic reconnection routines to handle outside network interruptions.

1 Like

Thanks Gunner (and to everyone else) as usual extremely exhaustive.
The difference that you have clearly illustrated is not shown clearly in the documentation and it would be a good idea to add these few lines of explanation.

Correct. The documentation is 50% terrible and should simply refer everyone to this forum.

@vshymanskyy FYI.

So what is the consensus of the question?
Have been trying to find out if calling is sufficient to handle server disconnect?
Does also connect/reconnect to the server or is it only managing housekeeping? I have not been able to verify one or the other and the documentation is not clear on this point. - for managing Blynk “stuff”. If Blynk.connect WAS NOT called earlier, it tries to connect as well.

So if I use Blynk.begin(auth, ssid, pass); in my setup, would be enough in a reconnect function or should I use Blynk.connect():? is an essential housekeeping command that keeps the background library “running”.

Why reopen an old topic for this again, it was also recently referenced in another current topic… Does one need to know the formula for gasoline to know that you need a constant flow of it to run a car?

We need to read ALL the documentation, often repeatedly and even after many years of using Blynk :wink: As well as compare differing situations and commands to understand the hows, whys and whens of many commands.

This leads to learning experiential information that may be beyond what is in the Docs… Good Documentation takes time and Blynk is constantly in development, so probably not a lot of time for both, thus hands on learning is a necessity. must be called as frequently as possible as it is the heart of the background Blynk process in your sketch.

That is basically it.

But, yes, it will try to connect if the server is not already connected. This is mentioned in the docs in reference to Blynk.config(). But there are many other situations in which you would need to use a different command like Blynk.connect() as you may purposely NOT have active as you may be disconnected while still wanting running code - C++ Blynk - Code Examples for Basic Tasks (Work in Progress)

If you need further info, please create a new topic with details of your specific code and/or needs of assistance in your project. Thank you.

1 Like