This is my first time experience with blynk libraries.
I wanted to understand how does blynk libraries work internally when used with our esp chips? Eg say methods like blynk.run() when used in our programs connect to blynk servers if connected to wifi…But at that time is information from blynk processed as esp being the client…or esp being the server? Knowing this will help me better take decisions with my architecture of my projects with blynk.
Please note that I am not asking if we can make esps connect to WiFi network in client/ server mode or not…
Hope i had explained the question well.
The Blynk client library that runs on the ESP is just that - a client.
The Blynk server can be run locally, on a Java capable device (i.e not on an ESP) or you can use the Blynk cloud servers.
The App talks to the server and the ESP talks to the server. The App and ESP never talk directly to each other when using WiFi.
Each time Blynk.run is executed, the ESP asks the server it it has any new data for it, and it also updates the server with any new data that it has.
In an ideal situation, Blynk.run should be executed hundreds of times per second. This allows the ESP to respond quickly to any commands that come from the App, via the server.
If the server doesn’t hear from the ESP for a long time (10 seconds by default) then the open TCP connection will be dropped, and the ESP will be listed as offline. If the ESP wants to re-connect with the server then an re-authentication and negotiation process needs to happen so a new open TCP connection can be established.
More info, including details of the protocol used, is here: