|
| 1 | +# AsyncTCP_RP2040W |
| 2 | + |
| 3 | +[](https://www.ardu-badge.com/AsyncTCP_RP2040W) |
| 4 | +[](https://github.com/khoih-prog/AsyncTCP_RP2040W/releases) |
| 5 | +[](#Contributing) |
| 6 | +[](http://github.com/khoih-prog/AsyncTCP_RP2040W/issues) |
| 7 | + |
| 8 | + |
| 9 | +<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a> |
| 10 | +<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a> |
| 11 | + |
| 12 | +--- |
| 13 | +--- |
| 14 | + |
| 15 | +## Table of contents |
| 16 | + |
| 17 | +* [Table of contents](#table-of-contents) |
| 18 | +* [Why do we need this AsyncTCP_RP2040W library](#why-do-we-need-this-AsyncTCP_RP2040W-library) |
| 19 | + * [Features](#features) |
| 20 | + * [Why Async is better](#why-async-is-better) |
| 21 | + * [Currently supported Boards](#currently-supported-boards) |
| 22 | +* [Changelog](changelog.md) |
| 23 | +* [Prerequisites](#prerequisites) |
| 24 | +* [Installation](#installation) |
| 25 | + * [Use Arduino Library Manager](#use-arduino-library-manager) |
| 26 | + * [Manual Install](#manual-install) |
| 27 | + * [VS Code & PlatformIO](#vs-code--platformio) |
| 28 | +* [Orignal documentation](#Orignal-documentation) |
| 29 | + * [AsyncClient and AsyncServer](#AsyncClient-and-AsyncServer) |
| 30 | + * [AsyncPrinter](#AsyncPrinter) |
| 31 | + * [AsyncTCPbuffer](#AsyncTCPbuffer) |
| 32 | + * [SyncClient](#SyncClient) |
| 33 | +* [Debug](#debug) |
| 34 | +* [Troubleshooting](#troubleshooting) |
| 35 | +* [Issues](#issues) |
| 36 | +* [TO DO](#to-do) |
| 37 | +* [DONE](#done) |
| 38 | +* [Contributions and Thanks](#contributions-and-thanks) |
| 39 | +* [Contributing](#contributing) |
| 40 | +* [License](#license) |
| 41 | +* [Copyright](#copyright) |
| 42 | + |
| 43 | +--- |
| 44 | +--- |
| 45 | + |
| 46 | +### Why do we need this [AsyncTCP_RP2040W library](https://github.com/khoih-prog/AsyncTCP_RP2040W) |
| 47 | + |
| 48 | +#### Features |
| 49 | + |
| 50 | +This library is based on, modified from: |
| 51 | + |
| 52 | +1. [Hristo Gochkov's ESPAsyncTCP](https://github.com/me-no-dev/ESPAsyncTCP) |
| 53 | + |
| 54 | +to apply the better and faster **asynchronous** feature of the **powerful** [ESPAsyncTCP Library](https://github.com/me-no-dev/ESPAsyncTCP) into **RASPBERRY_PI_PICO_W with CYW43439 WiFi**, and will be the base for future and more advanced Async libraries, such as AsyncWebServer_RP2040W, AsyncHTTPRequest_RP2040W, AsyncHTTPSRequest_RP2040W |
| 55 | + |
| 56 | + |
| 57 | +#### Why Async is better |
| 58 | + |
| 59 | +- Using asynchronous network means that you can handle **more than one connection at the same time** |
| 60 | +- **You are called once the request is ready and parsed** |
| 61 | +- When you send the response, you are **immediately ready** to handle other connections while the server is taking care of sending the response in the background |
| 62 | +- **Speed is OMG** |
| 63 | +- **Easy to use API, HTTP Basic and Digest MD5 Authentication (default), ChunkedResponse** |
| 64 | +- Easily extensible to handle **any type of content** |
| 65 | +- Supports Continue 100 |
| 66 | +- **Async WebSocket plugin offering different locations without extra servers or ports** |
| 67 | +- Async EventSource (Server-Sent Events) plugin to send events to the browser |
| 68 | +- URL Rewrite plugin for conditional and permanent url rewrites |
| 69 | +- ServeStatic plugin that supports cache, Last-Modified, default index and more |
| 70 | +- Simple template processing engine to handle templates |
| 71 | + |
| 72 | + |
| 73 | +### Currently supported Boards |
| 74 | + |
| 75 | +1. **RASPBERRY_PI_PICO_W with CYW43439 WiFi** using [**arduino-pico core v2.4.0+**](https://github.com/earlephilhower/arduino-pico) |
| 76 | + |
| 77 | + |
| 78 | +--- |
| 79 | +--- |
| 80 | + |
| 81 | +## Prerequisites |
| 82 | + |
| 83 | + 1. [`Arduino IDE 1.8.19+` for Arduino](https://github.com/arduino/Arduino). [](https://github.com/arduino/Arduino/releases/latest) |
| 84 | + 2. [`Earle Philhower's arduino-pico core v2.4.0+`](https://github.com/earlephilhower/arduino-pico) for **RASPBERRY_PI_PICO_W with CYW43439 WiFi**, etc. [](https://github.com/earlephilhower/arduino-pico/releases/latest) |
| 85 | + |
| 86 | +--- |
| 87 | +--- |
| 88 | + |
| 89 | +## Installation |
| 90 | + |
| 91 | +### Use Arduino Library Manager |
| 92 | + |
| 93 | +The best and easiest way is to use `Arduino Library Manager`. Search for [**AsyncTCP_RP2040W**](https://github.com/khoih-prog/AsyncTCP_RP2040W), then select / install the latest version. |
| 94 | +You can also use this link [](https://www.ardu-badge.com/AsyncTCP_RP2040W) for more detailed instructions. |
| 95 | + |
| 96 | +### Manual Install |
| 97 | + |
| 98 | +Another way to install is to: |
| 99 | + |
| 100 | +1. Navigate to [**AsyncTCP_RP2040W**](https://github.com/khoih-prog/AsyncTCP_RP2040W) page. |
| 101 | +2. Download the latest release `AsyncTCP_RP2040W-master.zip`. |
| 102 | +3. Extract the zip file to `AsyncTCP_RP2040W-master` directory |
| 103 | +4. Copy whole `AsyncTCP_RP2040W-master` folder to Arduino libraries' directory such as `~/Arduino/libraries/`. |
| 104 | + |
| 105 | +### VS Code & PlatformIO |
| 106 | + |
| 107 | +1. Install [VS Code](https://code.visualstudio.com/) |
| 108 | +2. Install [PlatformIO](https://platformio.org/platformio-ide) |
| 109 | +3. Install [**AsyncTCP_RP2040W** library](https://registry.platformio.org/libraries/khoih-prog/AsyncTCP_RP2040W) by using [Library Manager](https://registry.platformio.org/libraries/khoih-prog/AsyncTCP_RP2040W/installation). Search for **AsyncTCP_RP2040W** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22) |
| 110 | +4. Use included [platformio.ini](platformio/platformio.ini) file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples at [Project Configuration File](https://docs.platformio.org/page/projectconf.html) |
| 111 | + |
| 112 | +--- |
| 113 | +--- |
| 114 | + |
| 115 | +## Orignal documentation |
| 116 | + |
| 117 | +For ESP32, check [AsyncTCP Library](https://github.com/me-no-dev/AsyncTCP) |
| 118 | + |
| 119 | +[Join the ESPAsyncWebServer chat](https://gitter.im/me-no-dev/ESPAsyncWebServer) [](https://gitter.im/me-no-dev/ESPAsyncWebServer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
| 120 | + |
| 121 | +This is a fully asynchronous TCP library, aimed at enabling trouble-free, multi-connection network environment for Espressif's ESP8266 MCUs. |
| 122 | + |
| 123 | +### AsyncClient and AsyncServer |
| 124 | + |
| 125 | +The base classes on which everything else is built. They expose all possible scenarios, but are really raw and require more skills to use. |
| 126 | + |
| 127 | +### AsyncPrinter |
| 128 | + |
| 129 | +This class can be used to send data like any other `Print` interface (`Serial` for example). |
| 130 | + |
| 131 | +The object then can be used outside of the Async callbacks (the loop) and receive asynchronously data using `onData`. The object can be checked if the underlying `AsyncClient`is connected, or hook to the `onDisconnect` callback. |
| 132 | + |
| 133 | +### AsyncTCPbuffer |
| 134 | + |
| 135 | +This class is really similar to the `AsyncPrinter`, but it can buffer some of the incoming data. |
| 136 | + |
| 137 | +### SyncClient |
| 138 | + |
| 139 | +It is exactly what it sounds like. This is a standard, synchronous blocking TCP Client you're used to. |
| 140 | + |
| 141 | + |
| 142 | +--- |
| 143 | +--- |
| 144 | + |
| 145 | +### Debug |
| 146 | + |
| 147 | +Debug is enabled by default on Serial. |
| 148 | + |
| 149 | +You can also change the debugging level `_ASYNCTCP_RP2040W_LOGLEVEL_` from 0 to 4 in the library `cpp` files |
| 150 | + |
| 151 | +```cpp |
| 152 | +#define _ASYNCTCP_RP2040W_LOGLEVEL_ 1 |
| 153 | +``` |
| 154 | + |
| 155 | +--- |
| 156 | + |
| 157 | +### Troubleshooting |
| 158 | + |
| 159 | +If you get compilation errors, more often than not, you may need to install a newer version of the core for Arduino boards. |
| 160 | + |
| 161 | +Sometimes, the library will only work if you update the board core to the latest version because I am using newly added functions. |
| 162 | + |
| 163 | + |
| 164 | +--- |
| 165 | +--- |
| 166 | + |
| 167 | +### Issues |
| 168 | + |
| 169 | +Submit issues to: [AsyncTCP_RP2040W issues](https://github.com/khoih-prog/AsyncTCP_RP2040W/issues) |
| 170 | + |
| 171 | +--- |
| 172 | + |
| 173 | +## TO DO |
| 174 | + |
| 175 | +1. Search for bug and improvement. |
| 176 | + |
| 177 | + |
| 178 | +--- |
| 179 | + |
| 180 | +## DONE |
| 181 | + |
| 182 | +1. **RASPBERRY_PI_PICO_W with CYW43439 WiFi** |
| 183 | + |
| 184 | +--- |
| 185 | +--- |
| 186 | + |
| 187 | +### Contributions and Thanks |
| 188 | + |
| 189 | +Many thanks for everyone for bug reporting, new feature suggesting, testing and contributing to the development of this library. |
| 190 | + |
| 191 | +--- |
| 192 | + |
| 193 | +### Contributions and Thanks |
| 194 | + |
| 195 | +1. Based on and modified from [Hristo Gochkov's ESPAsyncTCP](https://github.com/me-no-dev/ESPAsyncTCP). Many thanks to [Hristo Gochkov](https://github.com/me-no-dev) for great [ESPAsyncTCP Library](https://github.com/me-no-dev/ESPAsyncTCP) |
| 196 | + |
| 197 | + |
| 198 | +<table> |
| 199 | + <tr> |
| 200 | + <td align="center"><a href="https://github.com/me-no-dev"><img src="https://github.com/me-no-dev.png" width="100px;" alt="me-no-dev"/><br /><sub><b>⭐️⭐️ Hristo Gochkov</b></sub></a><br /></td> |
| 201 | + </tr> |
| 202 | +</table> |
| 203 | + |
| 204 | +--- |
| 205 | + |
| 206 | +## Contributing |
| 207 | + |
| 208 | +If you want to contribute to this project: |
| 209 | +- Report bugs and errors |
| 210 | +- Ask for enhancements |
| 211 | +- Create issues and pull requests |
| 212 | +- Tell other people about this library |
| 213 | + |
| 214 | +--- |
| 215 | +--- |
| 216 | + |
| 217 | +### License |
| 218 | + |
| 219 | +- The library is licensed under [GPLv3](https://github.com/khoih-prog/AsyncTCP_RP2040W/blob/main/LICENSE) |
| 220 | + |
| 221 | +--- |
| 222 | + |
| 223 | +## Copyright |
| 224 | + |
| 225 | +Copyright 2022- Khoi Hoang |
| 226 | + |
| 227 | + |
0 commit comments