- This topic has 2 replies, 2 voices, and was last updated 2 years, 7 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
3D Printer 3D printer upgrade ABB Arduino Arduino IDE Arduino SAMD boards Aurora AWS CNC Cyclone PCB Factory Cyclone PCB Factory how to build It Display DynamoDB E32 E70 EByte esp01 esp32 esp8266 File System Firmware i2c Library LoRa MicroPython Milling PCB My PCB Networking PCB pinout Power saving Raspberry Pi REST API RF rp2040 SD Card Sensors Sleep and Wake UP SPI STM32 Temperature Tutorial Web Server Wemos D1 mini WiFi