How To Install Using Arduino Library Manager
Why do we need this Async AsyncHTTPSRequest_Generic Library
Features
1. Asynchronous HTTPS Request library for ESP32, ESP32_S2, ESP32_C3 using built-in WiFi.
2. Providing a subset of HTTPS.
3. Relying on on AsyncTCP_SSL for ESP32 using built-in WiFi
4. Methods similar in format and usage to XmlHTTPrequest in Javascript.
Supports:
1. GET, POST, PUT, PATCH, DELETE and HEAD
2. Request and response headers
3. Chunked response
4. Single String response for short (<~5K) responses (heap permitting).
5. Optional onData callback.
6. Optional onReadyStatechange callback.
Principles of operation
This library adds a simple HTTPS layer on top of the [/url]/AsyncTCP_SSL library to facilitate REST communication from a Client to a Server. The paradigm is similar to the XMLHttpRequest in Javascript, employing the notion of a ready-state progression through the transaction request.
Synchronization can be accomplished using callbacks on ready-state change, a callback on data receipt, or simply polling for ready-state change. Data retrieval can be incremental as received, or bulk retrieved when the transaction completes provided there is enough heap to buffer the entire response.
The underlying buffering uses a new xbuf class. It handles both character and binary data. Class xbuf uses a chain of small (64 byte) segments that are allocated and added to the tail as data is added and deallocated from the head as data is read, achieving the same result as a dynamic circular buffer limited only by the size of heap. The xbuf implements indexOf and readUntil functions.
For short transactions, buffer space should not be an issue. In fact, it can be more economical than other methods that use larger fixed length buffers. Data is acked when retrieved by the caller, so there is some limited flow control to limit heap usage for larger transfers.
Request and response headers are handled in the typical fashion.
Chunked responses are recognized and handled transparently.
This library is based on, modified from:
1. Bob Lemaire's asyncHTTPrequest Library
2. Khoi Hoang's AsyncHTTPRequest_Generic Library
Releases v1.1.0
1. Add support to ESP32-based WT32_ETH01 using LAN8720 using either ESP32 core v1.0.6- or core v2.0.0+
2. Add example for WT32_ETH01
Initial Releases v1.0.0
1. Initial coding to support Async HTTPS to ESP32, ESP32_S2 and ESP32_C3 using built-in WiFi
Currently Supported Boards
1. ESP32 including ESP32_S2 and ESP32_C3
Debug Termimal Output Samples
1. This is terminal debug output when running AsyncHTTPSRequest_ESP example on ESP32_DEV using built-in WiFi.
Code: Select all
Starting AsyncHTTPSRequest_ESP using ESP32_DEV
AsyncTCP_SSL v1.1.0
AsyncHTTPSRequest_Generic v1.0.0
Connecting to WiFi SSID: HueNet1
.......
AsyncHTTPSRequest @ IP : 192.168.2.78
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2021-10-21T16:05:03.170256-04:00
day_of_week: 4
day_of_year: 294
dst: true
dst_from: 2021-03-14T07:00:00+00:00
dst_offset: 3600
dst_until: 2021-11-07T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1634846703
utc_datetime: 2021-10-21T20:05:03.170256+00:00
utc_offset: -04:00
week_number: 42
**************************************
HHHHHH
**************************************
abbreviation: EDT
client_ip: aaa.bbb.ccc.ddd
datetime: 2021-10-21T16:06:00.828056-04:00
day_of_week: 4
day_of_year: 294
dst: true
dst_from: 2021-03-14T07:00:00+00:00
dst_offset: 3600
dst_until: 2021-11-07T06:00:00+00:00
raw_offset: -18000
timezone: America/Toronto
unixtime: 1634846760
utc_datetime: 2021-10-21T20:06:00.828056+00:00
utc_offset: -04:00
week_number: 42
**************************************