I'm trying to set up multiple SSL connections using TinyGSM and SSLClient for an ESP32 project. One connection is for MQTT and another for HTTPS communication. However, when creating the second SSLClient instance, I'm getting the warning: "Arduino client is already connected? Continuing anyway sometimes.
// First client setup
TinyGsmClient clientGSM(modem, 1); // First TinyGSM client
SSLClient net(clientGSM, TAs, (size_t)TAs_NUM, 3, 9); // First SSL client for MQTT
// Second client setup - This causes the warning
TinyGsmClient client2GSM(modem, 2); // Second TinyGSM client
SSLClient net2(client2GSM, TAs, (size_t)TAs_NUM, 3, 9); // Second SSL client - generates warning
and using net2 like
bool SensorAPI::sendRequest(const char* endpoint, const JsonDocument& doc) {
Serial.println("[Sensor API] Sendrequest invoked");
String requestBody;
serializeJson(doc, requestBody);
String vorp = String("/api/embedded/") + String(endpoint);
if(netINT.connect(serverName, 443)) {
Serial.println("[Sensor API] Connected to server");
netINT.println("POST " + vorp + " HTTP/1.1");
netINT.println("Host: " + String(serverName));
netINT.println("Content-Type: application/json");
netINT.println("Content-Length: " + String(requestBody.length()));
netINT.println("X-CSRFToken: " + String(csrfToken));
netINT.println("Connection: close");
netINT.println();
netINT.println(requestBody);
Serial.println("[Sensor API] Request sent");
if(netINT.available()) {
netINT.flush();
netINT.clearWriteError();
}
return true;
}
else {
Serial.println("[Sensor API] Connection failed");
return false;
}
return true;
}
I'm trying to set up multiple SSL connections using TinyGSM and SSLClient for an ESP32 project. One connection is for MQTT and another for HTTPS communication. However, when creating the second SSLClient instance, I'm getting the warning: "Arduino client is already connected? Continuing anyway sometimes.
and using net2 like