- This topic has 2 replies, 2 voices, and was last updated 3 years, 8 months ago by .
- You must be logged in to reply to this topic.
Tagged: ESPsyncWebServer
Good day
I am very new in this forum.
I realized a small project using the ES8266 and the ESPAsyncWebServer to control a couple of relays.
I created a web page that has the push buttons which change their color when the relevant relay is On or OFF.
I used the follwing line of code to auto refresh the page:
webPage ="<meta http-equiv='refresh' content='5'>";
The page update is working well but there is a problem because when the page is update the Browser send to the server the command that was last activated.
The relay comes ON and OFF at 5 secs rate !(e.g: the browser sends:” 192.169.1.80/relay1 “that toggles the relay state).
In the past I used the ESP8266webserver.h and the following line of code instructed the browser to engage the wanted IP with no command :
server.sendHeader("Location",String ("http://")+"192.168.1.80",true);
Could you please indicate to me the equivalent code to be used with ESPsyncWebServer ?
Thanks in advance for any reply / help .
Bye
Hi Newsoftman,
I think you must attach your code to help you.
ESPsyncWebServer uses the response to add the header, so if you post your code we tell you the correct position.
response->addHeader("Location",String ("http://")+"192.168.1.80");
I think you can find some information also here
Web server with esp8266 and esp32: multi purpose generic web server – 3
There is the ESP8266webserver and ESPAsyncWebServer implementation.
Bye Renzo
thanks a lot for the assistance: I found the following :
request->redirect("http://192.168.1.80");
It is working fine.
Bye
More
Just like a well-organized workbench, this website uses cookies to function properly and efficiently.
🛠️ The Essentials (Necessary): Some cookies are categorized as necessary and are stored on your browser because they are critical for the basic working of the site.
📊 The Analytics (Third-party): We also use third-party cookies to help us analyze traffic and understand which projects you like the most. These are stored only if you give us the green light.
You can choose to opt-out, but keep in mind that disabling them might make the site experience a bit less "smooth".
| Cookie | Duration | Description |
|---|---|---|
| cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
| cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
| cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
| cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
| cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
| viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
