Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No custom option when using websocket ? #23

Open
GregAscolab opened this issue Jan 12, 2024 · 3 comments
Open

No custom option when using websocket ? #23

GregAscolab opened this issue Jan 12, 2024 · 3 comments

Comments

@GregAscolab
Copy link
Contributor

Description :
If I use websocket, /setup page options are not displayed ?

Context :
v1.0.4
ESP32-WROOM

Step to reproduce :

  1. Use "withWebSocket.ino" example without modification :
  • Websocket "/" (root) page : works well displaying time every second.
  • "/setup" page :
    • did not display "My Options" tab in menu ???
    • did not dispaly "ESP Mode", nor "IP address", nor "Firmware"
    • "Loading" footer never ends...

Created config.json :

{
  "param-box1": "My Options",
  "LED Pin": 2,
  "Option 1": "Test option String",
  "Option 2": 1234567890
}
  1. Just comment "/" root page handler, and rebuild
// Add custom page handlers
  // server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
  //   request->send(200, "text/html", homepage);
  // });
  • Then "/" doesn't work (normal ;-) )
  • "/setup" page works : "my option" tab is back...
@cotestatnt
Copy link
Owner

Hi @GregAscolab.

Thanks for pointing out this insidious bug to me.
The problem is due to a double // in one of the response to a request made by the /setup page which is interpreted as the request inserted in the sketch / thus causing the page to malfunction.

I just committed the change (I also removed my test WiFi credentials that I use with on of my smartphones from the example 😱)

@ldijkman
Copy link

hmmm
same problem for me
no display custom addoptions button on setup page
when server on activated

arduino libraries say version 1.0.4 wich is the same as here i think

@ldijkman
Copy link

workaround for me now

if i look in the source
a page index htm not html
wil be served if present
if on
http://ipadres with or without /
http://mdsnsadres.local wit or without /

/home/dld/Arduino/libraries/AsyncEspFsWebserver/src/AsyncFsWebServer.cpp
line 61 62
onNotFound( std::bind(&AsyncFsWebServer::notFound, this, _1));
serveStatic("/", *m_filesystem, "/").setDefaultFile("index.htm");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants