Pouzita verze 2.5.1 odsud https://github.com/mathieucarbou/ESPAsyncWebServer (mela by obsahovat vsechny opravy + dalsi vylepseni).

This commit is contained in:
2024-01-27 09:56:20 +01:00
parent afbbf372bb
commit 49caf9e414
139 changed files with 713 additions and 18127 deletions

8
docs/_config.yml Normal file
View File

@ -0,0 +1,8 @@
# bundle exec jekyll serve --host=0.0.0.0
title: Asynchronous HTTP and WebSocket Server Library for ESP32
description: "Supports: WebSocket, SSE, Authentication, Arduino Json 7, File Upload, Static File serving, URL Rewrite, URL Redirect, etc"
remote_theme: pages-themes/cayman@v0.2.0
plugins:
- jekyll-remote-theme

56
docs/index.md Normal file
View File

@ -0,0 +1,56 @@
# ESP Async WebServer
[![License: LGPL 3.0](https://img.shields.io/badge/License-LGPL%203.0-yellow.svg)](https://opensource.org/license/lgpl-3-0/)
[![Continuous Integration](https://github.com/mathieucarbou/ESPAsyncWebServer/actions/workflows/ci.yml/badge.svg)](https://github.com/mathieucarbou/ESPAsyncWebServer/actions/workflows/ci.yml)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/mathieucarbou/library/ESP%20Async%20WebServer.svg)](https://registry.platformio.org/libraries/mathieucarbou/ESP%20Async%20WebServer)
Async Web Server for ESP31B
This fork is based on https://github.com/yubox-node-org/ESPAsyncWebServer and includes all the concurrency fixes.
## Changes
- SPIFFSEditor is removed
- Arduino Json 7 compatibility
- Deployed in PlatformIO registry and Arduino IDE library manager
- CI
- Only supports ESP32
## Documentation
Usage and API stays the same as the original library.
Please look at the original libraries for more examples and documentation.
[https://github.com/yubox-node-org/ESPAsyncWebServer](https://github.com/yubox-node-org/ESPAsyncWebServer)
## Pitfalls
The fork from yubox introduces some breaking API changes compared to the original library, especially regarding the use of `std::shared_ptr<std::vector<uint8_t>>` for WebSocket.
Thanks to this fork, you can handle them by using `ASYNCWEBSERVER_FORK_mathieucarbou`.
Here is an example for serializing a Json document in a websocket message buffer directly.
This code is compatible with both forks.
```cpp
void send(JsonDocument& doc) {
const size_t len = measureJson(doc);
#if defined(ASYNCWEBSERVER_FORK_mathieucarbou)
// this fork (originally from yubox-node-org), uses another API with shared pointer that better support concurrent use cases then the original project
auto buffer = std::make_shared<std::vector<uint8_t>>(len);
assert(buffer); // up to you to keep or remove this
serializeJson(doc, buffer->data(), len);
_ws->textAll(std::move(buffer));
#else
// original API from me-no-dev
AsyncWebSocketMessageBuffer* buffer = _ws->makeBuffer(len);
assert(buffer); // up to you to keep or remove this
serializeJson(doc, buffer->get(), len);
_ws->textAll(buffer);
#endif
}
```