add ESP31B support and fix header size

This commit is contained in:
Me No Dev
2016-01-30 02:24:29 +02:00
parent 63f8675816
commit 512e3f6c09
2 changed files with 14 additions and 6 deletions

View File

@ -341,7 +341,7 @@ void WebSockets::handleWebsocketCb(WSclient_t * client) {
buffer++; buffer++;
if(header->payloadLen == 126) { if(header->payloadLen == 126) {
headerLen += 4; headerLen += 2;
if(!handleWebsocketWaitFor(client, headerLen)) { if(!handleWebsocketWaitFor(client, headerLen)) {
return; return;
} }

View File

@ -53,9 +53,9 @@
#define WEBSOCKETS_MAX_HEADER_SIZE (14) #define WEBSOCKETS_MAX_HEADER_SIZE (14)
// select Network type based // select Network type based
#ifdef ESP8266 #if defined(ESP8266) || defined(ESP31B)
#define WEBSOCKETS_NETWORK_TYPE NETWORK_ESP8266 //#define WEBSOCKETS_NETWORK_TYPE NETWORK_ESP8266
//#define WEBSOCKETS_NETWORK_TYPE NETWORK_ESP8266_ASYNC #define WEBSOCKETS_NETWORK_TYPE NETWORK_ESP8266_ASYNC
#else #else
#define WEBSOCKETS_NETWORK_TYPE NETWORK_W5100 #define WEBSOCKETS_NETWORK_TYPE NETWORK_W5100
#endif #endif
@ -66,11 +66,15 @@
// No SSL/WSS support for client in Async mode // No SSL/WSS support for client in Async mode
// TLS lib need a sync interface! // TLS lib need a sync interface!
#ifndef ESP8266 #if !defined(ESP8266) && !defined(ESP31B)
#error "network type ESP8266 ASYNC only possible on the ESP mcu!" #error "network type ESP8266 ASYNC only possible on the ESP mcu!"
#endif #endif
#ifdef ESP8266
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#else
#include <ESP31BWiFi.h>
#endif
#include <ESPAsyncTCP.h> #include <ESPAsyncTCP.h>
#include <ESPAsyncTCPbuffer.h> #include <ESPAsyncTCPbuffer.h>
#define WEBSOCKETS_NETWORK_CLASS AsyncTCPbuffer #define WEBSOCKETS_NETWORK_CLASS AsyncTCPbuffer
@ -78,11 +82,15 @@
#elif (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) #elif (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
#ifndef ESP8266 #if !defined(ESP8266) && !defined(ESP31B)
#error "network type ESP8266 only possible on the ESP mcu!" #error "network type ESP8266 only possible on the ESP mcu!"
#endif #endif
#ifdef ESP8266
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#else
#include <ESP31BWiFi.h>
#endif
#define WEBSOCKETS_NETWORK_CLASS WiFiClient #define WEBSOCKETS_NETWORK_CLASS WiFiClient
#define WEBSOCKETS_NETWORK_SERVER_CLASS WiFiServer #define WEBSOCKETS_NETWORK_SERVER_CLASS WiFiServer