In the sketch I’m using, I’ve connection management for wifi and Blynk. Blynk connection can fail if the token value is wrong (as per the server). The serial monitor output shows “invalid token” error msg and says “Reconnecting to Blynk Server”.
I would like to take action in the connection based on the error e.g Invalid token, Cannot reach Blynk(if there are some name resolution issues and we reach a non-Blynk server etc). Is there a variable (or a call that returns the error code) that has the error code that one can use?
If the token id is invalid, I will want to take the device to the AP mode, display the wifiManager config screen to acquire the token id from the user.
Invalid token should not happen if all works well. In my case, using WiFiManager, I ended up putting in a token with an extra character. After it is saved, the device tries to connect to Blynk and fails. In such a situation, only a fresh flash works.
If this were a deployed device, this could happen if the provisioning is not done properly. Thus, this need/question. I’m a newbie coder and Blynker. Will take me a while to look at the libraries and modify them. Will try anyway.