The right / easy way for live two way commands
Posted: Wed Jul 29, 2020 12:41 pm
Hello.
I am new to ESP32...
What is the right way to create a "live" connection to my server, so the board can receive (and send) live commands, e.g when I press a button in my web server web interface the ESP would trigger the relay.
Sending part (from esp to server) can be easy and would be reliable to trigger a http GET command like example.com/esp.php?cmd=foo
And for simplicity, I can do this part that way^.
But what is the best practice and method for receiving commands ? An "ugly" way would be create a web server on ESP32 and deal with port forwarding and other unreliable things. Or to make the ESP constantly ask for new commands from server using http GET (not great).
I know there is a "sockets" method, but I am confused because of many examples and libraries, and some create "web" sockets, other create "tcp sockets" and I am kind of lost.
Another example I found on youtube involved installing tons of libraries and servers on both ends, not great eider.
What is the simplest and reliable way (sample code or library) to do the ESP32 receiving part ?
Thank you.
I am new to ESP32...
What is the right way to create a "live" connection to my server, so the board can receive (and send) live commands, e.g when I press a button in my web server web interface the ESP would trigger the relay.
Sending part (from esp to server) can be easy and would be reliable to trigger a http GET command like example.com/esp.php?cmd=foo
And for simplicity, I can do this part that way^.
But what is the best practice and method for receiving commands ? An "ugly" way would be create a web server on ESP32 and deal with port forwarding and other unreliable things. Or to make the ESP constantly ask for new commands from server using http GET (not great).
I know there is a "sockets" method, but I am confused because of many examples and libraries, and some create "web" sockets, other create "tcp sockets" and I am kind of lost.
Another example I found on youtube involved installing tons of libraries and servers on both ends, not great eider.
What is the simplest and reliable way (sample code or library) to do the ESP32 receiving part ?
Thank you.