Open Shravan1106 opened 3 years ago
basically the same the socketio variant has beginSslWithCA
too.
see:
https://github.com/Links2004/arduinoWebSockets/blob/master/src/SocketIOclient.h#L56-L59
But when I tried using it. I am getting the following error.
withssl:645:67: error: within this context
socketIO.beginSslWithCA(mainserver,443 , "/", ENDPOINT_CA_CERT);
^
withssl:645:67: error: 'WebSocketsClient' is not an accessible base of 'SocketIOclient'
how old is your arduino core / the WebSocket lib? are you still using AXTLS? the CA function are only possible with bareSSL and a a lib version >= 2.3.0
Yes. The lib version we are using is 2.3.0
I have a similar error: 'WebSocketsClient' is not an accessible base of 'SocketIOclient'. This happens when I call beginSocketSSLWithCA(const char, uint16_t, const char, const char, const char). I think because in protected Inheritance − When deriving from a protected base class, public and protected members of the base class become protected members of the derived class. Thanks
I'm currently experiencing the same issues. The one mentioned by @Shravan1106 and the one mentioned by @cmcampione with a ESP32 and ESP8266 My Core as well as all installed libraries are up to date. Are there any updates on this?
Not sure if this thread is still active. Therefore pinging you just in case you don't get any new notifications @Links2004
I have got a similar problem. I have a NodeJS server which uses secure socketIO. Without ssl, the socket works fine. As soon as i want to begin the connection with ssl i got a bunch of errors. Latest BearSSL lib, latest websockets lib, latest Arduino and PIO.
#include <Arduino.h>
#include <ArduinoBearSSL.h>
#define SSL_BARESSL
#include <utilities/globals.h>
#include <ArduinoJson.h>
#include <WebSocketsClient.h>
#include <SocketIOclient.h>
#include <utilities/fileSystem.h>
void serverCommSys::initWithSSL() {
char ca[10000];
hsh_fileSystem.readFile(SERVER_CA_PATH,ca);
Serial.printf("Connecting to HsH server on URL %s...\n",hsh_fileSystem.config.serverBaseURL);
socketIO.beginSslWithCA(hsh_fileSystem.config.serverBaseIP, 443, "/socket.io/?EIO=4",ca,"HsH");
socketIO.onEvent(socketIOEvent);
firstConnectionHappened = true;
}
In file included from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/hal/include/hal/sha_types.h:21,
from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/port/include/sha512_alt.h:28,
from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/sha512.h:70,
from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/entropy.h:34,
from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src/ssl_client.h:11,
from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src/WiFiClientSecure.h:26,
from lib/arduinoWebSockets/src/WebSockets.h:190,
from lib/arduinoWebSockets/src/WebSocketsClient.h:28,
from src/utilities/HsHServerComm.h:12,
from src/utilities/HsHServerComm.cpp:1:
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/esp_rom/include/esp32/rom/sha.h:39:12: error: 'SHA1' redeclared as different kind of symbol
SHA1 = 0,
^
In file included from lib/ArduinoBearSSL/src/ArduinoBearSSL.h:35,
from src/utilities/HsHServerComm.h:9,
from src/utilities/HsHServerComm.cpp:1:
lib/ArduinoBearSSL/src/SHA1.h:50:18: note: previous declaration 'SHA1Class SHA1'
extern SHA1Class SHA1;
^~~~
In file included from src/utilities/HsHServerComm.h:12,
from src/utilities/HsHServerComm.cpp:1:
lib/arduinoWebSockets/src/WebSocketsClient.h:67:107: error: 'BearSSL' has not been declared
void beginSocketIOSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino");
^~~~~~~
lib/arduinoWebSockets/src/WebSocketsClient.h:67:125: error: expected ',' or '...' before '*' token
void beginSocketIOSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino");
^
lib/arduinoWebSockets/src/WebSocketsClient.h:67:10: error: default argument missing for parameter 4 of 'void WebSocketsClient::beginSocketIOSSLWithCA(const char*, uint16_t, const char*, int)'
void beginSocketIOSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino");
^~~~~~~~~~~~~~~~~~~~~~
src/utilities/HsHServerComm.cpp: In member function 'void serverCommSys::initWithSSL()':
src/utilities/HsHServerComm.cpp:25:98: error: 'void WebSocketsClient::beginSslWithCA(const char*, uint16_t, const char*, const char*, const char*)' is inaccessible within this context
socketIO.beginSslWithCA(hsh_fileSystem.config.serverBaseIP, 443, "/socket.io/?EIO=4",ca,"HsH");
^
In file included from src/utilities/HsHServerComm.h:12,
from src/utilities/HsHServerComm.cpp:1:
lib/arduinoWebSockets/src/WebSocketsClient.h:55:10: note: declared here
void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", const char * CA_cert = NULL, const char * protocol = "arduino");
^~~~~~~~~~~~~~
src/utilities/HsHServerComm.cpp:25:98: error: 'WebSocketsClient' is not an accessible base of 'SocketIOclient'
socketIO.beginSslWithCA(hsh_fileSystem.config.serverBaseIP, 443, "/socket.io/?EIO=4",ca,"HsH");
^
*** [.pio\build\esp-wrover-kit\src\utilities\HsHServerComm.cpp.o] Error 1
In file included from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/hal/include/hal/sha_types.h:21,
from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/port/include/sha512_alt.h:28,
from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/sha512.h:70,
from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/mbedtls/mbedtls/include/mbedtls/entropy.h:34,
from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src/ssl_client.h:11,
from C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src/WiFiClientSecure.h:26,
from lib/arduinoWebSockets/src/WebSockets.h:190,
from lib/arduinoWebSockets/src/WebSocketsClient.h:28,
from src/utilities/HsHServerComm.h:12,
from src/main.cpp:36:
C:/Users/Pc/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/esp_rom/include/esp32/rom/sha.h:39:12: error: 'SHA1' redeclared as different kind of symbol
SHA1 = 0,
^
In file included from lib/ArduinoBearSSL/src/ArduinoBearSSL.h:35,
from src/utilities/HsHServerComm.h:9,
from src/main.cpp:36:
lib/ArduinoBearSSL/src/SHA1.h:50:18: note: previous declaration 'SHA1Class SHA1'
extern SHA1Class SHA1;
^~~~
In file included from src/utilities/HsHServerComm.h:12,
from src/main.cpp:36:
lib/arduinoWebSockets/src/WebSocketsClient.h:67:107: error: 'BearSSL' has not been declared
void beginSocketIOSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino");
^~~~~~~
lib/arduinoWebSockets/src/WebSocketsClient.h:67:125: error: expected ',' or '...' before '*' token
void beginSocketIOSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino");
^
lib/arduinoWebSockets/src/WebSocketsClient.h:67:10: error: default argument missing for parameter 4 of 'void WebSocketsClient::beginSocketIOSSLWithCA(const char*, uint16_t, const char*, int)'
void beginSocketIOSSLWithCA(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino");
^~~~~~~~~~~~~~~~~~~~~~
*** [.pio\build\esp-wrover-kit\src\main.cpp.o] Error 1
SSL connections are supported with beginSslWithCA() as shown in the WebSocketClientSSLWithCA example code. How to use it for websocketSocket-ioClient?