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 31, 2024. It is now read-only.
### Releases v1.6.0
1. 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](khoih-prog/Portenta_H7_AsyncWebServer#8) and [All memmove() removed - string no longer destroyed #11](khoih-prog/Portenta_H7_AsyncWebServer#11)
2. Add multiple examples to demo the new feature
*[1. Async_AdvancedWebServer on Teensy4.1 QNEthernet](#1-Async_AdvancedWebServer-on-Teensy41-QNEthernet)
97
100
*[2. WebClient on Teensy4.1 QNEthernet](#2-WebClient-on-Teensy41-QNEthernet)
98
101
*[3. MQTTClient_Auth on Teensy4.1 QNEthernet](#3-MQTTClient_Auth-on-Teensy41-QNEthernet)
99
102
*[4. MQTTClient_Basic on Teensy4.1 QNEthernet](#4-MQTTClient_Basic-on-Teensy41-QNEthernet)
100
103
*[5. MQTT_ThingStream on Teensy4.1 QNEthernet](#5-MQTT_ThingStream-on-Teensy41-QNEthernet)
104
+
*[6. Async_AdvancedWebServer_MemoryIssues_Send_CString on Teensy4.1 QNEthernet](#6-Async_AdvancedWebServer_MemoryIssues_Send_CString-on-Teensy41-QNEthernet)
101
105
*[Debug](#debug)
102
106
*[Troubleshooting](#troubleshooting)
103
107
*[Issues](#issues)
@@ -108,6 +112,80 @@
108
112
*[License](#license)
109
113
*[Copyright](#copyright)
110
114
115
+
---
116
+
---
117
+
118
+
119
+
### Important Note from v1.6.0
120
+
121
+
The new `v1.6.0+` has added a new and powerful feature to permit using `CString` to save heap to send `very large data`.
122
+
123
+
Check the `marvelleous` PRs of **@salasidis** in [Portenta_H7_AsyncWebServer library](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer)
124
+
-[request->send(200, textPlainStr, jsonChartDataCharStr); - Without using String Class - to save heap #8](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/8)
125
+
-[All memmove() removed - string no longer destroyed #11](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/11)
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.
170
+
171
+
172
+
3. To use `CString` without copying while sending. Use function
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
187
+
188
+
111
189
---
112
190
---
113
191
@@ -152,7 +230,7 @@ to apply the better and faster **asynchronous** feature of the **powerful** [ESP
152
230
1.[`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [](https://github.com/arduino/Arduino/releases/latest)
153
231
2.[`Teensy core v1.57+`](https://www.pjrc.com/teensy/td_download.html) for Teensy 4.1. [](https://github.com/PaulStoffregen/cores/releases/latest)
154
232
3.[`QNEthernet Library version v0.15.0+`](https://github.com/ssilverman/QNEthernet) for Teensy 4.1 built-in Ethernet
155
-
4.[`Teensy41_AsyncTCP library v1.0.0+`](https://github.com/khoih-prog/Teensy41_AsyncTCP) to use **Teensy 4.1 using QNEthernet Library**. [](https://github.com/khoih-prog/Teensy41_AsyncTCP/releases/latest)
233
+
4.[`Teensy41_AsyncTCP library v1.1.0+`](https://github.com/khoih-prog/Teensy41_AsyncTCP) to use **Teensy 4.1 using QNEthernet Library**. [](https://github.com/khoih-prog/Teensy41_AsyncTCP/releases/latest)
156
234
157
235
---
158
236
@@ -207,7 +285,7 @@ These files must be copied into the directory:
207
285
## Important things to remember
208
286
209
287
- This is fully asynchronous server and as such does not run on the loop thread.
210
-
- You can not use yield() or delay() or any function that uses them inside the callbacks
288
+
- You can not use `yield()` or `delay()` or any function that uses them inside the callbacks
211
289
- The server is smart enough to know when to close the connection and free resources
212
290
- 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.
1087
+
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.
1010
1088
1011
1089
```cpp
1012
1090
voidloop(){
@@ -1018,8 +1096,8 @@ void loop(){
1018
1096
1019
1097
## Async Event Source Plugin
1020
1098
1021
-
The server includes EventSource (Server-Sent Events) plugin which can be used to send short text events to the browser.
1022
-
Difference between EventSource and WebSockets is that EventSource is single direction, text-only protocol.
1099
+
The server includes `EventSource` (Server-Sent Events) plugin which can be used to send short text events to the browser.
1100
+
Difference between `EventSource` and `WebSockets` is that `EventSource` is single direction, text-only protocol.
You can access the Async Advanced WebServer @ the server IP
1288
1368
@@ -1308,7 +1388,7 @@ Following are debug terminal output and screen shots when running example [Async
1308
1388
1309
1389
```
1310
1390
Start Async_AdvancedWebServer on TEENSY 4.1 with Teensy4.1 QNEthernet
1311
-
AsyncWebServer_Teensy41 v1.5.0
1391
+
AsyncWebServer_Teensy41 v1.6.0
1312
1392
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107
1313
1393
HTTP EthernetWebServer is @ IP : 192.168.2.107
1314
1394
```
@@ -1326,7 +1406,7 @@ Following is debug terminal output when running example [WebClient](examples/Web
1326
1406
1327
1407
```
1328
1408
Start WebClient on TEENSY 4.1 with Teensy4.1 QNEthernet
1329
-
AsyncWebServer_Teensy41 v1.5.0
1409
+
AsyncWebServer_Teensy41 v1.6.0
1330
1410
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107
1331
1411
1332
1412
Starting connection to server...
@@ -1397,7 +1477,7 @@ Following is debug terminal output when running example [MQTTClient_Auth](exampl
1397
1477
1398
1478
```
1399
1479
Start MQTTClient_Auth on TEENSY 4.1 with Teensy4.1 QNEthernet
1400
-
AsyncWebServer_Teensy41 v1.5.0
1480
+
AsyncWebServer_Teensy41 v1.6.0
1401
1481
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107
1402
1482
Attempting MQTT connection to broker.emqx.io...connected
1403
1483
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on TEENSY 4.1 with Teensy4.1 QNEthernet
@@ -1417,7 +1497,7 @@ Following is debug terminal output when running example [MQTTClient_Basic](examp
1417
1497
1418
1498
```
1419
1499
Start MQTTClient_Basic on TEENSY 4.1 with Teensy4.1 QNEthernet
1420
-
AsyncWebServer_Teensy41 v1.5.0
1500
+
AsyncWebServer_Teensy41 v1.6.0
1421
1501
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107
1422
1502
Attempting MQTT connection to broker.emqx.io...connected
1423
1503
Message Send : MQTT_Pub => Hello from MQTTClient_Basic on TEENSY 4.1 with Teensy4.1 QNEthernet
@@ -1444,7 +1524,7 @@ Following is debug terminal output when running example [MQTT_ThingStream](examp
1444
1524
1445
1525
```
1446
1526
Start MQTT_ThingStream on TEENSY 4.1 with Teensy4.1 QNEthernet
1447
-
AsyncWebServer_Teensy41 v1.5.0
1527
+
AsyncWebServer_Teensy41 v1.6.0
1448
1528
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107
1449
1529
***************************************
1450
1530
Teensy41_Pub
@@ -1465,6 +1545,72 @@ MQTT Message Send : Teensy41_Pub => Hello from MQTT_ThingStream on TEENSY 4.1 wi
1465
1545
MQTT Message receive [Teensy41_Pub] Hello from MQTT_ThingStream on TEENSY 4.1 with Teensy4.1 QNEthernet
1466
1546
```
1467
1547
1548
+
1549
+
---
1550
+
1551
+
#### 6. Async_AdvancedWebServer_MemoryIssues_Send_CString on Teensy4.1 QNEthernet
1552
+
1553
+
Following is the debug terminal and screen shot when running example [Async_AdvancedWebServer_MemoryIssues_Send_CString](examples/Async_AdvancedWebServer_MemoryIssues_Send_CString), on `ESP8266_NODEMCU_ESP12E with ESP8266_W5500 Ethernet`, to demonstrate the new and powerful `HEAP-saving` feature
1554
+
1555
+
1556
+
##### Using CString ===> smaller heap (61,440 bytes) for 40,000-byte buffer
1557
+
1558
+
```
1559
+
Start Async_AdvancedWebServer_MemoryIssues_Send_CString on TEENSY 4.1 with Teensy4.1 QNEthernet
1560
+
AsyncWebServer_Teensy41 v1.6.0
1561
+
1562
+
HEAP DATA - Start => Free heap: 483328 Used heap: 0
1563
+
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.83
1564
+
HTTP EthernetWebServer is @ IP : 192.168.2.83
1565
+
1566
+
HEAP DATA - Pre Create Arduino String Free heap: 442368 Used heap: 40960
1567
+
.
1568
+
HEAP DATA - Pre Send Free heap: 438272 Used heap: 45056
1569
+
1570
+
HEAP DATA - Post Send Free heap: 421888 Used heap: 61440
1571
+
......
1572
+
Out String Length=31243
1573
+
.....
1574
+
```
1575
+
1576
+
While using `Arduino String`, the HEAP usage is very large
1577
+
1578
+
1579
+
#### Async_AdvancedWebServer_MemoryIssues_SendArduinoString ===> larger heap (65,536 bytes) while buffer len is only 12K Bytes
1580
+
1581
+
1582
+
```
1583
+
Start Async_AdvancedWebServer_MemoryIssues_SendArduinoString on TEENSY 4.1 with Teensy4.1 QNEthernet
1584
+
AsyncWebServer_Teensy41 v1.5.0
1585
+
1586
+
HEAP DATA - Start => Free heap: 483328 Used heap: 0
1587
+
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.83
1588
+
HTTP EthernetWebServer is @ IP : 192.168.2.83
1589
+
.
1590
+
HEAP DATA - Pre Send Free heap: 438272 Used heap: 45056
1591
+
1592
+
HEAP DATA - Post Send Free heap: 417792 Used heap: 65536
1593
+
......
1594
+
Out String Length=11191
1595
+
... ...
1596
+
Out String Length=11233
1597
+
.......
1598
+
Out String Length=11192
1599
+
.......
1600
+
Out String Length=11204
1601
+
... ...
1602
+
Out String Length=11214
1603
+
```
1604
+
1605
+
1606
+
You can access the Async Advanced WebServers at the displayed server IP, e.g. `192.168.2.83`
@@ -1513,19 +1659,23 @@ Submit issues to: [AsyncWebServer_Teensy41 issues](https://github.com/khoih-prog
1513
1659
5. Add Table-of-Contents and Version String
1514
1660
6. Fix issue with slow browsers or network. Check [Target stops responding after variable time when using Firefox on Windows 10 #3](https://github.com/khoih-prog/AsyncWebServer_RP2040W/issues/3)
1515
1661
7. Add functions and example `Async_AdvancedWebServer_favicon` to support `favicon.ico`
1516
-
1662
+
8. 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)
1663
+
1517
1664
---
1518
1665
---
1519
1666
1520
1667
1521
1668
### Contributions and Thanks
1522
1669
1523
1670
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)
1524
-
1671
+
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)
1672
+
-[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` to save heap to send `very large data`
1673
+
-[All memmove() removed - string no longer destroyed #11](https://github.com/khoih-prog/Portenta_H7_AsyncWebServer/pull/11), leading to `v1.6.0` to remove `memmove()` and not to destroy String anymore
0 commit comments