Blynk_Async_WM using AsyncWebServer

khoih-prog
Posts: 53
Joined: Sat Feb 22, 2020 8:16 pm

Blynk_Async_WM using AsyncWebServer

Postby khoih-prog » Mon Aug 31, 2020 8:21 pm

Blynk_Async_WM Library


How To Install Using Arduino Library Manager
Image


Why do we need this Blynk_Async_WM Library

- Using asynchronous network means that you can handle more than one connection at the same time
- You are called once the request is ready and parsed
- 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
- Speed is OMG
- Easy to use API, HTTP Basic and Digest MD5 Authentication (default), ChunkedResponse
- Easily extendible to handle any type of content
- Supports Continue 100
- Async WebSocket plugin offering different locations without extra servers or ports
- Async EventSource (Server-Sent Events) plugin to send events to the browser
- URL Rewrite plugin for conditional and permanent url rewrites
- ServeStatic plugin that supports cache, Last-Modified, default index and more
- Simple template processing engine to handle templates


This is a Blynk and WiFiManager Library, using ESPAsyncWebServer instead of (ESP8266)WebServer, for configuring/auto(re)connecting ESP8266/ESP32 modules to the best or available MultiWiFi APs and MultiBlynk servers at runtime. Connection is with or without SSL. Configuration data to be saved in either LittleFS, SPIFFS or EEPROM. Default Credentials as well as Dynamic custom parameters can be added and modified easily without coding knowledge. DoubleResetDetector is used to force Config Portal opening even if the Credentials are still valid.

This library is designed to help you to eliminate hardcoding your Wifi and Blynk credentials for ESP8266 and ESP32 (with/without SSL), and updating/reflashing every time you need to change them.

This Blynk_Async_WM Library is based on and sync'ed with Blynk_WM Library, therefore all the features currently supported by Blynk_WM Library will be available. Please have a look at Blynk_WM Library for those too-many-to-list features.


Releases v1.0.16

1. Initial coding to use ESPAsyncWebServer instead of (ESP8266)WebServer.
2. Bump up to v1.0.16 to sync with Blynk_WM Library v1.0.16.

---

So, how it works?

If it cannot connect to the Blynk server in 30 seconds, no valid stored Credentials or Double Reset is detected within default abd configurable 10s, it will switch to Configuration Mode. You will see your built-in LED turned ON. In Configuration Mode, it starts an AP with default name ESP_xxxxxx and password MyESP_xxxxxx or configurable name and password you specified. The AP IP address is default at 192.168.4.1 or configured IP (e.g. 192.168.200.1).

First, connect your (PC, Laptop, Tablet, phone, etc.) WiFi to Config Portal AP, then enter the WiFi password :

Image

1. If you choose not to load default Credentials and Dynamic Parameters

After you connected, please, go to http://192.168.4.1 or the configured AP IP. The following Config Portal screen will appear:

Image

2. If you choose to load default Credentials and Dynamic Parameters

After you connected, please, go to http://192.168.4.1 or the configured AP IP. The following Config Portal screen will appear:

Image

Enter your WiFi and Blynk Credentials:

Image

Then click Save. The system will auto-restart. You will see the board's built-in LED turned OFF. That means, it's already connected to your Blynk server successfully.


How to migrate from Blynk_WM Library

In your code, just replacing

1. BlynkSimpleEsp8266_WM.h with BlynkSimpleEsp8266_Async_WM.h for ESP8266 without SSL
2. BlynkSimpleEsp8266_SSL_WM.h with BlynkSimpleEsp8266_SSL_Async_WM.h for ESP8266 with SSL
3. BlynkSimpleEsp32_WM.h with BlynkSimpleEsp32_Async_WM.h for ESP32 without SSL
4. BlynkSimpleEsp32_SSL_WM.h with BlynkSimpleEsp32_SSL_Async_WM.h for ESP32 with SSL

How to migrate from Blynk

In your code, replace
1. BlynkSimpleEsp8266.h with BlynkSimpleEsp8266_Async_WM.h for ESP8266 without SSL
2. BlynkSimpleEsp8266_SSL.h with BlynkSimpleEsp8266_SSL_Async_WM.h for ESP8266 with SSL
3. BlynkSimpleEsp32.h with BlynkSimpleEsp32_Async_WM.h for ESP32 without SSL
4. BlynkSimpleEsp32_SSL.h with BlynkSimpleEsp32_SSL_Async_WM.h for ESP32 with SSL

Who is online

Users browsing this forum: No registered users and 44 guests