Hello, i was wondering if the following is possible...
1) Can an ESP32 running as a web server initiate/make HTTP requests to an external Rest API ?
2) Do i need to set it up both as a server and a client at the same time or can the ESP-IDF Server API initiate/make requests also?
3) Will the traffic for both incoming and outgoing requests be handled (for port forwarding reasons) by the same port ?
As an example think of an ESP32 used in automation with its own WEB UI making HTTP Requests to Shelly products polling sensors or controlling actuators.
Thanks in advance.
ESP32 web server initiating HTTP requests to external Rest API?
-
- Posts: 3
- Joined: Sat Oct 09, 2021 10:45 pm
Re: ESP32 web server initiating HTTP requests to external Rest API?
1&2. Yes, an ESP32 can have a HTTP server to respond to requests from clients, as well as a HTTP client to send requests to servers. They may speak the same language but these are separate functions with different roles.
3. No, but this isn't a concern. Your typical router firewall will block all incoming connection requests, but not outgoing ones. Think of all the devices on your network that are connected to the internet without any special firewall rules! You don't need to do anything for the client.
3. No, but this isn't a concern. Your typical router firewall will block all incoming connection requests, but not outgoing ones. Think of all the devices on your network that are connected to the internet without any special firewall rules! You don't need to do anything for the client.
-
- Posts: 3
- Joined: Sat Oct 09, 2021 10:45 pm
Re: ESP32 web server initiating HTTP requests to external Rest API?
Awesome, I was afraid that running server and client together might cause issues or conflicts that would be hard to spot and debug and would need special handling. It's good to know that this isn't the case and that they are both handled gracefully under the hood by esp-idf.
Thank you again, i will soon be giving this a try.
Thank you again, i will soon be giving this a try.
Who is online
Users browsing this forum: Baidu [Spider] and 118 guests