me-no-dev / ESPAsyncWebServer

Async Web Server for ESP8266 and ESP32
3.76k stars 1.22k forks source link

How To: Make Dynamic Spiffs/littleFS html file as captive portal with ESPasync? #947

Closed duckylock closed 3 years ago

duckylock commented 3 years ago

Hi, I already posted some issues to use ESPasync with Captive portal and processor function. But I ll try to take some back on what I m trying to do and maybe somebody have a nice "how to" to do that.

I want to load a captive portal (to setup the ESP module) with a websocket to manage some contents in the html page.

For that, I need to put the IP address of the websocket in this captive portal html page. after that I will have the link between my web page and my ESP module.

It works perfectly for a none captive portal page...but...

some help? thanks community!

duckylock commented 3 years ago

Hi, I tried some workaround to figure out my needs and I want to share it... if my exp. can help others ...

1) I've never find anything that explain if it's technically possible to have captive portal with template html and async websocket features... I understand it was not created for that.... I think I already done that before with the ESP8266 lib (with the onNotFound() event) but I understand it's not an Async webserver and the "under the hood" is not the same...

2) So I thought I will be able to redirect the captive portal page to another page and send some date by GET ou POST methode.... unfortunately I could read this link that give it to me a better understanding of what is a captive portals and the secure behaviour issue it can be... https://security.stackexchange.com/questions/185031/how-should-captive-portals-redirect

So what I understand is : -I cannot be able to have template html page as captive portals with websocket (I may want feed the socket ip to the template) -I cannot be able to have dynamic html captive portal only redirect (with POST or GET data) to a template html page with websocket function -but...I can maybe use

3) Simple dynamic html captive portal with form and submit button I may feed the websocket ip info in this form. when the user will press submit button it transmit the websocket IP by POST methode to the final template html page with websocket function and I will be able to use it to change my content live....

I ll try that and let you know if it works and/or if it simple to manage...

thanks

stale[bot] commented 3 years ago

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 3 years ago

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.