8000 add ESP31B support and fix header size · robokoding/arduinoWebSockets@512e3f6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 512e3f6

Browse files
author
Me No Dev
committed
add ESP31B support and fix header size
1 parent 63f8675 commit 512e3f6

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/WebSockets.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ void WebSockets::handleWebsocketCb(WSclient_t * client) {
341341
buffer++;
342342

343343
if(header->payloadLen == 126) {
344-
headerLen += 4;
344+
headerLen += 2;
345345
if(!handleWebsocketWaitFor(client, headerLen)) {
346346
return;
347347
}

src/WebSockets.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353
#define WEBSOCKETS_MAX_HEADER_SIZE (14)
5454

5555
// select Network type based
56-
#ifdef ESP8266
57-
#define WEBSOCKETS_NETWORK_TYPE NETWORK_ESP8266
58-
//#define WEBSOCKETS_NETWORK_TYPE NETWORK_ESP8266_ASYNC
56+
#if defined(ESP8266) || defined(ESP31B)
57+
//#define WEBSOCKETS_NETWORK_TYPE NETWORK_ESP8266
58+
#define WEBSOCKETS_NETWORK_TYPE NETWORK_ESP8266_ASYNC
5959
#else
6060
#define WEBSOCKETS_NETWORK_TYPE NETWORK_W5100
6161
#endif
@@ -66,23 +66,31 @@
6666
// No SSL/WSS support for client in Async mode
6767
// TLS lib need a sync interface!
6868

69-
#ifndef ESP8266
69+
#if !defined(ESP8266) && !defined(ESP31B)
7070
#error "network type ESP8266 ASYNC only possible on the ESP mcu!"
7171
#endif
7272

73+
#ifdef ESP8266
7374
#include <ESP8266WiFi.h>
75+
#else
76+
#include <ESP31BWiFi.h>
77+
#endif
7478
#include <ESPAsyncTCP.h>
7579
#include <ESPAsyncTCPbuffer.h>
7680
#define WEBSOCKETS_NETWORK_CLASS AsyncTCPbuffer
7781
#define WEBSOCKETS_NETWORK_SERVER_CLASS AsyncServer
7882

7983
#elif (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
8084

81-
#ifndef ESP8266
85+
#if !defined(ESP8266) && !defined(ESP31B)
8286
#error "network type ESP8266 only possible on the ESP mcu!"
8387
#endif
8488

89+
#ifdef ESP8266
8590
#include <ESP8266WiFi.h>
91+
#else
92+
#include <ESP31BWiFi.h>
93+
#endif
8694
#define WEBSOCKETS_NETWORK_CLASS WiFiClient
8795
#define WEBSOCKETS_NETWORK_SERVER_CLASS WiFiServer
8896

0 commit comments

Comments
 (0)
0