/* * WebSocketClientSSLWithCA.ino * * Created on: 27.10.2019 * * note SSL is only possible with the ESP8266 * */ #include #include #include #include ESP8266WiFiMulti WiFiMulti; WebSocketsClient webSocket; #define USE_SERIAL Serial1 // Can be obtained with: // openssl s_client -showcerts -connect echo.websocket.org:443 0; t--) { USE_SERIAL.printf("[SETUP] BOOT WAIT %d...\n", t); USE_SERIAL.flush(); delay(1000); } WiFiMulti.addAP("SSID", "passpasspass"); while(WiFiMulti.run() != WL_CONNECTED) { delay(100); } //When using BearSSL, client certificate and private key can be set: //webSocket.setSSLClientCertKey(clientCert, clientPrivateKey); //clientCert and clientPrivateKey can be of types (const char *, const char *) , or of types (BearSSL::X509List, BearSSL::PrivateKey) webSocket.beginSslWithCA("echo.websocket.org", 443, "/", ENDPOINT_CA_CERT); webSocket.onEvent(webSocketEvent); } void loop() { webSocket.loop(); }