Links2004 / arduinoWebSockets

arduinoWebSockets
GNU Lesser General Public License v2.1
1.87k stars 553 forks source link

Websocket is crashing when defining AXTLS #465

Open ersinpw opened 5 years ago

ersinpw commented 5 years ago

Does someone else experience the same problem when defining AXTLS?

This is my code:

#define USING_AXTLS
#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WebSocketsServer.h>
#include <Hash.h>

void setup()
{ 

}

void loop()
{

}

Error:

/src/WebSockets.h:142:38: error: 'WiFiClientSecure' does not name a type
 #define WEBSOCKETS_NETWORK_SSL_CLASS WiFiClientSecure

/src/WebSockets.h:248:5: note: in expansion of macro 'WEBSOCKETS_NETWORK_SSL_CLASS'
     WEBSOCKETS_NETWORK_SSL_CLASS * ssl;
ersinpw commented 5 years ago

@Links2004 is this bug already known? Because I also can't use it in combination with e.g. https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/HTTPSRequestCACertAxTLS/HTTPSRequestCACertAxTLS.ino

Links2004 commented 5 years ago

based on this example here: https://github.com/esp8266/Arduino/blob/92373a98370618dea09718010b30d311a97f3f25/libraries/ESP8266WiFi/examples/HTTPSRequestAxTLS/HTTPSRequestAxTLS.ino

you need

#define USING_AXTLS
#include <ESP8266WiFi.h>

// force use of AxTLS (BearSSL is now default)
#include <WiFiClientSecureAxTLS.h>
using namespace axTLS;

if the USING_AXTLS is not working correct its more a problem in the Arduino ESP8266 core then the websocket library.