Using multiple possible Clients to connect Blynk to the internet


We have been using Blynk within our ESP32 + Arduino framework project successfully for some time now, using a Sim7600 to make an GPRS connection. The Blynk object is an instance of BlynkSim and so we can provide the Blynk object with the TinyGsm client in the config(...) method.

In our next project we will have wired Ethernet available, but we also want to keep using the Sim7600 and the TinyGsm library as a backup internet connection. A separate library of our own NetworkProvider will manage the different connections (ethernet, sim7600, …) and notify if something changes in this regard. This library can provide a Client instance ( EthernetClient, TinyGsmClient, … ) of the preferred and connected connection.

So, on this notification, I would like Blynk to reconnect using the provided preferred Client …
but I do not understand fully the structure that Blynk uses regarding Protocol, ArduinoClient etc …

So I would like some help in how to set this up.

Should I create my own derivative of BlynkProtocol<BlynkArduinoClient>, but without the connection type specific methods that i.e. BlynkSIM has (connectNetwork, config(TinyGsm...) )?

Or is there a better way to implement this?

Have you looked at this…


That looks just right … . I’ll investigate this further !


1 Like