arduinoWebSockets icon indicating copy to clipboard operation
arduinoWebSockets copied to clipboard

SSL Connection not working

Open Sumis34 opened this issue 1 month ago • 0 comments

I'm using this code her with Aduino IDE in VSCode and a ESP 32. When i try to connect to the Server with SSL it dose not work.

Am I missing something?

void setup() {
    WiFi.mode(WIFI_STA);
    WiFi.setHostname(hostname.c_str());
    Serial.begin(115200);
    WiFiManager wm;

    bool res = wm.autoConnect("Glowb Setup");

    if (!res) {
        Serial.println("Failed to connect");
        // ESP.restart();
    } else {
        // if you get here you have connected to the WiFi
        Serial.println("connected...yeey :)");
    }

    String macAddress = String(ESP.getEfuseMac(), HEX);

    setClock();

    // DEV MODE
    //  ws.begin("192.168.1.127", 5005, "/ws?id=" + macAddress);

    // PROD MODE
    const char* url = ("/ws?id=" + macAddress).c_str();
    ws.beginSSL("example.ch", 443, url, NULL, "");

    // event handler
    ws.onEvent(webSocketEvent);

    // try ever 5000 again if connection has failed
    ws.setReconnectInterval(5000);
}

Sumis34 avatar Jun 25 '24 16:06 Sumis34