You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Project moved to [ESP32Async](https://github.com/ESP32Async) organization at [https://github.com/ESP32Async/ESPAsyncWebServer](https://github.com/ESP32Async/ESPAsyncWebServer)
The library can be downloaded from the releases page at [https://github.com/ESP32Async/ESPAsyncWebServer/releases](https://github.com/ESP32Async/ESPAsyncWebServer/releases).
Most of the crashes are caused by improper use or configuration of the AsyncTCP library used for the project.
123
+
Here are some recommendations to avoid them and build-time flags you can change.
124
+
125
+
`CONFIG_ASYNC_TCP_MAX_ACK_TIME` - defines a timeout for TCP connection to be considered alive when waiting for data.
126
+
In some bad network conditions you might consider increasing it.
127
+
128
+
`CONFIG_ASYNC_TCP_QUEUE_SIZE` - defines the length of the queue for events related to connections handling.
129
+
Both the server and AsyncTCP library were optimized to control the queue automatically. Do NOT try blindly increasing the queue size, it does not help you in a way you might think it is. If you receive debug messages about queue throttling, try to optimize your server callbacks code to execute as fast as possible.
130
+
Read #165 thread, it might give you some hints.
131
+
132
+
`CONFIG_ASYNC_TCP_RUNNING_CORE` - CPU core thread affinity that runs the queue events handling and executes server callbacks. Default is ANY core, so it means that for dualcore SoCs both cores could handle server activities. If your server's code is too heavy and unoptimized or you see that sometimes
133
+
server might affect other network activities, you might consider to bind it to the same core that runs Arduino code (1) to minimize affect on radio part. Otherwise you can leave the default to let RTOS decide where to run the thread based on priority
134
+
135
+
`CONFIG_ASYNC_TCP_STACK_SIZE` - stack size for the thread that runs sever events and callbacks. Default is 16k that is a way too much waste for well-defined short async code or simple static file handling. You might want to cosider reducing it to 4-8k to same RAM usage. If you do not know what this is or not sure about your callback code demands - leave it as default, should be enough even for very hungry callbacks in most cases.
136
+
137
+
> [!NOTE]
138
+
> This relates to ESP32 only, ESP8266 uses different ESPAsyncTCP lib that does not has this build options
139
+
140
+
I personally use the following configuration in my projects:
-D CONFIG_ASYNC_TCP_RUNNING_CORE=1// force async_tcp task to be on same core as Arduino app (default is any core)
147
+
-D CONFIG_ASYNC_TCP_STACK_SIZE=4096// reduce the stack size (default is 16K)
148
+
```
149
+
150
+
If you need to serve chunk requests with a really low buffer (which should be avoided), you can set `-D ASYNCWEBSERVER_USE_CHUNK_INFLIGHT=0` to disable the in-flight control.
- (perf) Performance improvements in terms of memory, speed and size
67
178
68
-
---
69
-
70
-
## WARNING: Important notes about future version 4.x
179
+
**WARNING: Important notes about future version 4.x**
71
180
72
-
This ESPAsyncWebServer fork is now at version 3.x, where we try to keep the API compatibility with original project as much as possible.
181
+
ESPAsyncWebServer is now at version 3.x, where we try to keep the API compatibility with original project as much as possible.
73
182
74
183
We plan on creating a next major 4.x version that will:
75
184
@@ -85,41 +194,6 @@ Maintaining a library for ESP8266 and RP2040 has a real cost and clearly what we
85
194
86
195
If you are an ESP8266 user and want to help improve current 3.x, you are more than welcomed to contribute to this community effort.
87
196
88
-
## Dependencies
89
-
90
-
> [!WARNING]
91
-
> The library name was changed from `ESP Async WebServer` to `ESPAsyncWebServer` as per the Arduino Lint recommendations, but its name had to stay `ESP Async WebServer` in Arduino Registry.
92
-
93
-
**PlatformIO / pioarduino:**
94
-
95
-
```ini
96
-
lib_compat_mode = strict
97
-
lib_ldf_mode = chain
98
-
lib_deps = ESP32Async/ESPAsyncWebServer
99
-
```
100
-
101
-
**Dependencies:**
102
-
103
-
-**ESP32 with AsyncTCP**: [`ESP32Async/AsyncTCP`](https://github.com/ESP32Async/AsyncTCP/releases)
104
-
-**ESP32 with AsyncTCPSock**: `https://github.com/ESP32Async/AsyncTCPSock/archive/refs/tags/v1.0.3-dev.zip`
@@ -171,43 +245,11 @@ Test is running for 20 seconds with 10 connections.
171
245
// Total: 2038 events, 509.50 events / second
172
246
```
173
247
174
-
## Important recommendations for build options
175
-
176
-
Most of the crashes are caused by improper use or configuration of the AsyncTCP library used for the project.
177
-
Here are some recommendations to avoid them and build-time flags you can change.
178
-
179
-
`CONFIG_ASYNC_TCP_MAX_ACK_TIME` - defines a timeout for TCP connection to be considered alive when waiting for data.
180
-
In some bad network conditions you might consider increasing it.
181
-
182
-
`CONFIG_ASYNC_TCP_QUEUE_SIZE` - defines the length of the queue for events related to connections handling.
183
-
Both the server and AsyncTCP library in this fork were optimized to control the queue automatically. Do NOT try blindly increasing the queue size, it does not help you in a way you might think it is. If you receive debug messages about queue throttling, try to optimize your server callbacks code to execute as fast as possible.
184
-
Read #165 thread, it might give you some hints.
185
-
186
-
`CONFIG_ASYNC_TCP_RUNNING_CORE` - CPU core thread affinity that runs the queue events handling and executes server callbacks. Default is ANY core, so it means that for dualcore SoCs both cores could handle server activities. If your server's code is too heavy and unoptimized or you see that sometimes
187
-
server might affect other network activities, you might consider to bind it to the same core that runs Arduino code (1) to minimize affect on radio part. Otherwise you can leave the default to let RTOS decide where to run the thread based on priority
188
-
189
-
`CONFIG_ASYNC_TCP_STACK_SIZE` - stack size for the thread that runs sever events and callbacks. Default is 16k that is a way too much waste for well-defined short async code or simple static file handling. You might want to cosider reducing it to 4-8k to same RAM usage. If you do not know what this is or not sure about your callback code demands - leave it as default, should be enough even for very hungry callbacks in most cases.
190
-
191
-
> [!NOTE]
192
-
> This relates to ESP32 only, ESP8266 uses different ESPAsyncTCP lib that does not has this build options
193
-
194
-
I personally use the following configuration in my projects:
-D CONFIG_ASYNC_TCP_RUNNING_CORE=1// force async_tcp task to be on same core as Arduino app (default is any core)
201
-
-D CONFIG_ASYNC_TCP_STACK_SIZE=4096// reduce the stack size (default is 16K)
202
-
```
203
-
204
-
If you need to serve chunk requests with a really low buffer (which should be avoided), you can set `-D ASYNCWEBSERVER_USE_CHUNK_INFLIGHT=0` to disable the in-flight control.
205
-
206
248
## `AsyncWebSocketMessageBuffer` and `makeBuffer()`
207
249
208
250
The fork from [yubox-node-org](https://github.com/yubox-node-org/ESPAsyncWebServer) introduces some breaking API changes compared to the original library, especially regarding the use of `std::shared_ptr<std::vector<uint8_t>>` for WebSocket.
209
251
210
-
This fork is compatible with the original library from [me-no-dev](https://github.com/me-no-dev/ESPAsyncWebServer) regarding WebSocket, and wraps the optimizations done by `yubox-node-org` in the `AsyncWebSocketMessageBuffer` class.
252
+
This library is compatible with the original library from [me-no-dev](https://github.com/me-no-dev/ESPAsyncWebServer) regarding WebSocket, and wraps the optimizations done by `yubox-node-org` in the `AsyncWebSocketMessageBuffer` class.
211
253
So you have the choice of which API to use.
212
254
213
255
Here are examples for serializing a Json document in a websocket message buffer:
0 commit comments