083683425f479a3e4df0b6a7d5d43980c09e1cb8
flush causes a bunch of reads as we try to close the socket on esp32. I think flush is broken on that platform. the comments indicate confusion. added some debug logs for important cases that were missing them, some missing newlines to exisitng logs. added a longer yield when waiting for data, in some super busy cases it could trigger a task watchdog or otherwise starve the system. (yield alone doesn't always switch to lower priority tasks) make some other yields conditional to avoid some waste when it would double-yield.
WebSocket Server and Client for Arduino 
a WebSocket Server and Client for Arduino based on RFC6455.
Supported features of RFC6455
- text frame
- binary frame
- connection close
- ping
- pong
- continuation frame
Limitations
- max input length is limited to the ram size and the
WEBSOCKETS_MAX_DATA_SIZEdefine - max output length has no limit (the hardware is the limit)
- Client send big frames with mask 0x00000000 (on AVR all frames)
- continuation frame reassembly need to be handled in the application code
Limitations for Async
- Functions called from within the context of the websocket event might not honor
yield()and/ordelay(). See this issue for more info and a potential workaround. - wss / SSL is not possible.
Supported Hardware
- ESP8266 Arduino for ESP8266
- ESP32 Arduino for ESP32
- ESP31B
- Particle with STM32 ARM Cortex M3
- ATmega328 with Ethernet Shield (ATmega branch)
- ATmega328 with enc28j60 (ATmega branch)
- ATmega2560 with Ethernet Shield (ATmega branch)
- ATmega2560 with enc28j60 (ATmega branch)
Note:
version 2.0 and up is not compatible with AVR/ATmega, check ATmega branch.
Arduino for AVR not supports std namespace of c++.
wss / SSL
supported for:
- wss client on the ESP8266
- wss / SSL is not natively supported in WebSocketsServer however it is possible to achieve secure websockets by running the device behind an SSL proxy. See Nginx for a sample Nginx server configuration file to enable this.
ESP Async TCP
This libary can run in Async TCP mode on the ESP.
The mode can be activated in the WebSockets.h (see WEBSOCKETS_NETWORK_TYPE define).
ESPAsyncTCP libary is required.
High Level Client API
begin: Initiate connection sequence to the websocket host.
void begin(const char *host, uint16_t port, const char * url = "/", const char * protocol = "arduino");
void begin(String host, uint16_t port, String url = "/", String protocol = "arduino");
onEvent: Callback to handle for websocket events
void onEvent(WebSocketClientEvent cbEvent);
WebSocketClientEvent: Handler for websocket events
void (*WebSocketClientEvent)(WStype_t type, uint8_t * payload, size_t length)
Where WStype_t type is defined as:
typedef enum {
WStype_ERROR,
WStype_DISCONNECTED,
WStype_CONNECTED,
WStype_TEXT,
WStype_BIN,
WStype_FRAGMENT_TEXT_START,
WStype_FRAGMENT_BIN_START,
WStype_FRAGMENT,
WStype_FRAGMENT_FIN,
} WStype_t;
Issues
Submit issues to: https://github.com/Links2004/arduinoWebSockets/issues
License and credits
The library is licensed under LGPLv2.1
libb64 written by Chris Venter. It is distributed under Public Domain see LICENSE.
Description
arduinoWebSockets modded to allow for custom auth with socketIO --
Forked from https://github.com/Links2004/arduinoWebSockets
Languages
C++
84.3%
C
8.9%
Shell
2.5%
Python
2.4%
JavaScript
1.1%
Other
0.8%