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
{{ message }}
This repository was archived by the owner on Jan 29, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+59-42
Original file line number
Diff line number
Diff line change
@@ -107,55 +107,73 @@
107
107
108
108
### Important Note from v1.6.0
109
109
110
-
The new `v1.6.0` has added a new and powerful feature to permit using `CString` to save heap to send `very large data`.
110
+
The new `v1.6.0+` has added a new and powerful feature to permit using `CString` in optional `SDRAM` to save heap to send `very large data`.
111
111
112
-
Check the `marvelleous` PR of **@salasidis**[request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/8) and these new examples
112
+
Check the `marvelleous` PRs of **@salasidis** in [Portenta_H7_AsyncWebServer library](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer)
113
+
-[request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/8)
114
+
-[All memmove() removed - string no longer destroyed #11](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/11)
The required HEAP is also around**2 times of the CString size**
158
+
The required additional HEAP is also about**2 times of the CString size** because of `unnecessary copies` of the CString in HEAP. Avoid this `unefficient` way.
146
159
147
160
148
-
3. To use `CString`but destroy it after sending. Use function
161
+
3. To use `CString`without copying while sending. Use function
The required HEAP is also about **1 times of the CString size**.
175
+
The required additional HEAP is about **1 times of the CString size**. This way is the best and most efficient way to use by avoiding of `unnecessary copies` of the CString in HEAP
176
+
159
177
160
178
161
179
---
@@ -256,7 +274,7 @@ The best and easiest way is to use `Arduino Library Manager`. Search for `AsyncW
256
274
## Important things to remember
257
275
258
276
- This is fully asynchronous server and as such does not run on the loop thread.
259
-
- You can not use yield() or delay() or any function that uses them inside the callbacks
277
+
- You can not use `yield()` or `delay()` or any function that uses them inside the callbacks
260
278
- The server is smart enough to know when to close the connection and free resources
261
279
- You can not send more than one response to a single request
Browsers sometimes do not correctly close the websocket connection, even when the close() function is called in javascript. This will eventually exhaust the web server's resources and will cause the server to crash. Periodically calling the cleanClients() function from the main loop() function limits the number of clients by closing the oldest client when the maximum number of clients has been exceeded. This can called be every cycle, however, if you wish to use less power, then calling as infrequently as once per second is sufficient.
1078
+
Browsers sometimes do not correctly close the websocket connection, even when the `close()` function is called in javascript. This will eventually exhaust the web server's resources and will cause the server to crash. Periodically calling the `cleanClients()` function from the main `loop()` function limits the number of clients by closing the oldest client when the maximum number of clients has been exceeded. This can called be every cycle, however, if you wish to use less power, then calling as infrequently as once per second is sufficient.
1061
1079
1062
1080
```cpp
1063
1081
voidloop(){
@@ -1069,8 +1087,8 @@ void loop(){
1069
1087
1070
1088
## Async Event Source Plugin
1071
1089
1072
-
The server includes EventSource (Server-Sent Events) plugin which can be used to send short text events to the browser.
1073
-
Difference between EventSource and WebSockets is that EventSource is single direction, text-only protocol.
1090
+
The server includes `EventSource` (Server-Sent Events) plugin which can be used to send short text events to the browser.
1091
+
Difference between `EventSource` and `WebSockets` is that `EventSource` is single direction, text-only protocol.
1074
1092
1075
1093
### Setup Event Source on the server
1076
1094
@@ -1436,12 +1454,12 @@ You can access the Async Advanced WebServer @ the server IP
1436
1454
1437
1455
#### 1. AsyncMultiWebServer_WT32_ETH01 on WT32-ETH01 with ETH_PHY_LAN8720
1438
1456
1439
-
Following are debug terminal output and screen shots when running example [AsyncMultiWebServer_WT32_ETH01](examples/AsyncMultiWebServer_WT32_ETH01) on WT32-ETH01 with ETH_PHY_LAN8720, using EP32 core v2.0.0, to demonstrate the operation of 3 independent AsyncWebServers on 3 different ports and how to handle the complicated AsyncMultiWebServers.
1457
+
Following are debug terminal output and screen shots when running example [AsyncMultiWebServer_WT32_ETH01](examples/AsyncMultiWebServer_WT32_ETH01) on `WT32-ETH01 with ETH_PHY_LAN8720`, using ESP32 core `v2.0.0+`, to demonstrate the operation of 3 independent AsyncWebServers on 3 different ports and how to handle the complicated AsyncMultiWebServers.
1440
1458
1441
1459
1442
1460
```
1443
1461
Starting AsyncMultiWebServer_WT32_ETH01 on WT32-ETH01 with ETH_PHY_LAN8720
1444
-
AsyncWebServer_WT32_ETH01 v1.6.0 for core v2.0.0+
1462
+
AsyncWebServer_WT32_ETH01 v1.6.1 for core v2.0.0+
1445
1463
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232
1446
1464
FULL_DUPLEX, 100Mbps
1447
1465
@@ -1472,32 +1490,28 @@ You can access the Async Advanced WebServers @ the server IP and corresponding p
1472
1490
1473
1491
#### 2. Async_AdvancedWebServer_MemoryIssues_Send_CString on WT32-ETH01 with ETH_PHY_LAN8720
1474
1492
1475
-
Following is the debug terminal and screen shot when running example [Async_AdvancedWebServer_MemoryIssues_Send_CString](examples/Async_AdvancedWebServer_MemoryIssues_Send_CString), on WT32-ETH01 with ETH_PHY_LAN8720, to demonstrate the new and powerful `HEAP-saving` feature
1493
+
Following is the debug terminal and screen shot when running example [Async_AdvancedWebServer_MemoryIssues_Send_CString](examples/Async_AdvancedWebServer_MemoryIssues_Send_CString), on `WT32-ETH01 with ETH_PHY_LAN8720`, to demonstrate the new and powerful `HEAP-saving` feature
1476
1494
1477
1495
1478
-
##### Using CString ===> smaller heap (120,876 bytes)
1496
+
##### Using CString ===> smaller heap (120,880 bytes)
1479
1497
1480
1498
```
1481
1499
Start Async_AdvancedWebServer_MemoryIssues_Send_CString on WT32-ETH01 with ETH_PHY_LAN8720
1482
-
AsyncWebServer_WT32_ETH01 v1.6.0 for core v2.0.0+
1500
+
AsyncWebServer_WT32_ETH01 v1.6.1 for core v2.0.0+
1483
1501
1484
1502
ETH Started
1485
1503
ETH Connected
1486
1504
ETH MAC: A8:48:FA:08:4B:FF, IPv4: 192.168.2.76
1487
1505
FULL_DUPLEX, 100Mbps
1488
1506
HTTP EthernetWebServer is @ IP : 192.168.2.232
1489
1507
1490
-
HEAP DATA - Pre Create Arduino String Max heap: 326680 Free heap: 216212 Used heap: 110468
1508
+
HEAP DATA - Pre Create Arduino String Max heap: 326680 Free heap: 216200 Used heap: 110480
1491
1509
.
1492
1510
HEAP DATA - Pre Send Max heap: 326680 Free heap: 212292 Used heap: 114388
1493
1511
1494
-
HEAP DATA - Post Send Max heap: 326680 Free heap: 205848 Used heap: 120832
1495
-
.
1496
-
HEAP DATA - Post Send Max heap: 326680 Free heap: 205816 Used heap: 120864
1497
-
..
1498
-
HEAP DATA - Post Send Max heap: 326680 Free heap: 205812 Used heap: 120868
1499
-
...... ..
1500
-
HEAP DATA - Post Send Max heap: 326680 Free heap: 205804 Used heap: 120876
1512
+
HEAP DATA - Post Send Max heap: 326680 Free heap: 205832 Used heap: 120848
1513
+
1514
+
HEAP DATA - Post Send Max heap: 326680 Free heap: 205800 Used heap: 120880
While using `Arduino String`, the HEAP usage is very large
1507
1521
1508
1522
1509
-
#### Async_AdvancedWebServer_MemoryIssues_SendArduinoString ===> very large heap (152,088 bytes)
1523
+
#### Async_AdvancedWebServer_MemoryIssues_SendArduinoString ===> very large heap (152,136 bytes)
1510
1524
1511
1525
```
1512
1526
Start Async_AdvancedWebServer_MemoryIssues_SendArduinoString on WT32-ETH01 with ETH_PHY_LAN8720
1513
-
AsyncWebServer_WT32_ETH01 v1.6.0 for core v2.0.0+
1527
+
AsyncWebServer_WT32_ETH01 v1.6.1 for core v2.0.0+
1514
1528
1515
1529
ETH Started
1516
1530
ETH Connected
1517
-
ETH MAC: A8:48:FA:08:4B:FF, IPv4: 192.168.2.76
1531
+
ETH MAC: A8:48:FA:08:4B:FF, IPv4: 192.168.2.232
1518
1532
FULL_DUPLEX, 100Mbps
1519
1533
HTTP EthernetWebServer is @ IP : 192.168.2.232
1520
1534
1521
-
HEAP DATA - Pre Create Arduino String Max heap: 326952 Free heap: 256484 Used heap: 70468
1535
+
HEAP DATA - Pre Create Arduino String Max heap: 326968 Free heap: 256504 Used heap: 70464
1522
1536
.
1523
-
HEAP DATA - Pre Send Max heap: 326952 Free heap: 212600 Used heap: 114352
1537
+
HEAP DATA - Pre Send Max heap: 326968 Free heap: 212596 Used heap: 114372
1524
1538
1525
-
HEAP DATA - Post Send Max heap: 326952 Free heap: 174864 Used heap: 152088
1526
-
....... .......... .......... ..........
1527
-
.......... .......... .......... ........
1539
+
HEAP DATA - Post Send Max heap: 326968 Free heap: 174856 Used heap: 152112
1540
+
......... .......... .......... .......... ...
1541
+
HEAP DATA - Post Send Max heap: 326968 Free heap: 174832 Used heap: 152136
1542
+
....... .......... ..........
1528
1543
Out String Length=31247
1529
1544
.. .......... .
1530
1545
```
@@ -1573,13 +1588,13 @@ Submit issues to: [AsyncWebServer_WT32_ETH01 issues](https://github.com/khoih-pr
1573
1588
1574
1589
## DONE
1575
1590
1576
-
1. Initial port to WT32_ETH01 boards using built-in LAN8720A Ethernet
1591
+
1. Initial port to `WT32_ETH01` boards using built-in `LAN8720A` Ethernet
1577
1592
2. Add more examples.
1578
1593
3. Add debugging features.
1579
1594
4. Add Table-of-Contents and Version String
1580
-
5. Support breaking ESP32 core v2.0.0+ as well as v1.0.6-
1581
-
6. Auto detect ESP32 core v1.0.6- or v2.0.0+ to use correct settings
1582
-
7. Display compiler `#warning` only when DEBUG_LEVEL is 3+
1595
+
5. Support breaking ESP32 core `v2.0.0+` as well as `v1.0.6-`
1596
+
6. Auto detect ESP32 core `v1.0.6-` or `v2.0.0+` to use correct settings
1597
+
7. Display compiler `#warning` only when `DEBUG_LEVEL` is 3+
1583
1598
8. Fix AsyncWebSocket bug
1584
1599
9. Support using `CString` to save heap to send `very large data`. Check [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/8)
1585
1600
@@ -1591,7 +1606,9 @@ Submit issues to: [AsyncWebServer_WT32_ETH01 issues](https://github.com/khoih-pr
1591
1606
### Contributions and Thanks
1592
1607
1593
1608
1. Based on and modified from [Hristo Gochkov's ESPAsyncWebServer](https://github.com/me-no-dev/ESPAsyncWebServer). Many thanks to [Hristo Gochkov](https://github.com/me-no-dev) for great [ESPAsyncWebServer Library](https://github.com/me-no-dev/ESPAsyncWebServer)
1594
-
2. Thanks to [salasidis](https://github.com/salasidis) aka [rs77can](https://forum.arduino.cc/u/rs77can) to discuss and make the mavellous PR [request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/8), leading to `v1.2.0` to support using `CString` to save heap to send `very large data`
1609
+
2. Thanks to [salasidis](https://github.com/salasidis) aka [rs77can](https://forum.arduino.cc/u/rs77can) to discuss and make the following `marvellous` PRs in [Portenta_H7_AsyncWebServer library](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer)
1610
+
-[request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/8), leading to `v1.6.0` to support using `CString` in optional `SDRAM` to save heap to send `very large data`
1611
+
-[All memmove() removed - string no longer destroyed #11](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/11), leading to `v1.6.1` to remove `memmove()` and not to destroy String anymore
0 commit comments