* Change compiler error to runtime error.
Add compiler warining when a ASYNCWEBSERVER_REGEX function is used, but not enabled
* Update docs for usage in Arduino IDE
* Update docs for platform.local.txt
* Add function so that the total number of web-socket clients can be limited easily. This is to cope with a problem when a browser does not close the web-socket connection correctly. I have observed this on Chromium based browsers. The memory leak will eventually lead to the server crashing. Normally only one connection per client is required, so limiting the number of connections would not normally cause any problems.
* Prevent an assertion failure when using WebSockets
Frequently when using Web Sockets you will get the assert failure:
assertion "new_rcv_ann_wnd <= 0xffff" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/lwip/src/core/tcp.c", line 779, function: tcp_update_rcv_ann_wnd
This will happen particulary when you close the browser window. This change
prevents the issue from occuring.
* Do not use thread locking with the ESP8266, but instead use an empty placeholder class that can be used to implement locking at a later date.
* Do not use thread locking with the ESP8266, but instead use an empty placeholder class that can be used to implement locking at a later date.
* Add function so that the total number of web-socket clients can be limited easily. This is to cope with a problem when a browser does not close the web-socket connection correctly. I have observed this on Chromium based browsers. The memory leak will eventually lead to the server crashing. Normally only one connection per client is required, so limiting the number of connections would not normally cause any problems.
* Set the default number of ws clients dependent on processor.
* Added handler for correct JSON deserialization (even with multiple body data writes), addresses #195
* Fixed typo
* Added JSON handler example to readme
* Moved Json Handler uri parameter to constructor
* Use request->_tempObject for JSON char data buffer
* Moved onRequest to constructor in JSON async handler
* Removed unnecessary memmove from chunked response generation.
* Added simple template processor to AsyncFileResponse.
Unzipped files in SPIFFS, Streams, PROGMEM strings, callback/chunked responses may have template placeholders like %TEMPLATE_VAR% inside. If callback is specified in Async...Response constructor call, it will be used to replace these with actual strings.
The prototype of callback is String(const String&), i.e. it gets variable name and returns its value.
Template variables' delimiter is currently percent sign ('%').
Maximal placeholder length is 32 chars (chosen somewhat arbitrarily, it may be stored on stack during processing). It is not guaranteed that placeholders longer than that will be processed.
Signed-off-by: Alexandr Zarubkin <me21@yandex.ru>
Unzipped files in SPIFFS, Streams, PROGMEM strings, callback/chunked responses may have template placeholders like %TEMPLATE_VAR% inside. If callback is specified in Async...Response constructor call, it will be used to replace these with actual strings.
The prototype of callback is String(const String&), i.e. it gets variable name and returns its value.
Template variables' delimiter is currently percent sign ('%').
Maximal placeholder length is 32 chars (chosen somewhat arbitrarily, it may be stored on stack during processing). It is not guaranteed that placeholders longer than that will be processed.
Signed-off-by: Alexandr Zarubkin <me21@yandex.ru>
# Conflicts:
# src/WebResponses.cpp
* Add support for a MultiMessage where the buffer is shared between WS messages to multiple clients.
Add ability to create a WS buffer directly and write to it, saving duplication of message in RAM, then send it. example below is an arduinoJson message.
```cpp
void sendDataWs(AsyncWebSocketClient * client)
{
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
root["a"] = "abc";
root["b"] = "abcd";
root["c"] = "abcde";
root["d"] = "abcdef";
root["e"] = "abcdefg";
size_t len = root.measureLength();
AsyncWebSocketMessageBuffer * buffer = ws.makeBuffer(len); // creates a buffer (len + 1) for you.
if (buffer) {
root.printTo((char *)buffer->get(), len + 1);
if (client) {
client->text(buffer);
} else {
ws.textAll(buffer);
}
}
}
```
* Add example to readme.
* Reset all handlers. This allowing to use same server few times during app life.
E.g. for WiFi manager when hardware sepups WiFi connection and as HTTP server during hardware life cycle
* New - server.rewirte() to rewrite the request url with optional get parameters injection.
New - rewrite.setFilter() and handler.setFilter() to specify a filter callback for more control on when to include them.
New - static file handler can be set with Last-Modified header value to support Not-Modified (304) response instead of serving the actual file.
* Remove clearRewrites & clearHandlers from server.mplement server distractor to delete internal members. Fixed and improved gzip stats calculation.
* This handler will serve a 302 response to a client request for a SPIFFS file if the request comes from the STA side of the ESP network.
If the request comes from the AP side then it serves the file from SPIFFS.
* corrections. plus readme
* Update README.md
extra space
* move wifi to cpp
* Prevent buffer overflow on received data
* pass to 7 char to avoid save to flash by SDK
* return _contentLength, avoid array reparse to know len
* Added FlashStringHelper for text and binary
* Added FlashStringHelper also to AsyncWebSocketClient
* Added PROGMEM doc
* Corrected binary was sending PSTR as text, addded len
* Server calls client method and code as asked @me-no-dev
* server calls client method and code as asked by @me-no-dev
* Changed Code presentation
* Added printf_P methods
* Prevent buffer overflow on received data
* pass to 7 char to avoid save to flash by SDK
* return _contentLength, avoid array reparse to know len
* Added FlashStringHelper for text and binary
* Added FlashStringHelper also to AsyncWebSocketClient
* Added PROGMEM doc
* Corrected binary was sending PSTR as text, addded len
* Server calls client method and code as asked @me-no-dev
* server calls client method and code as asked by @me-no-dev
* Changed Code presentation