You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With ESP8266, using HTTP client from inside a ESPAsyncWebServer callback always returns a "connection refused" error.
Same function called from anywhere outside the callback works as expected.
No problem at all with ESP32, both calls return the expected content.
Me No Dev @CosmicMac I am not sure that hat can really be done (in a simple way)
it work on ESP32 because ESP32 is running FreeRTOS and network is handled inside a thread
that allows you to delay the response a bit and run that client inside
though... it's not a good approach either because you are in effect halting all other connections
I am thinking on making AsyncTCP multithreaded on ESP32 to overcome this shortcoming, but obviosly also not something that can be done on esp8266
the way I see this working in eneral is to detach the client from the server and manage it's data and callbacks separately to be entangled with the http client
Cosmic Mac
Thanks a lot @me-no-dev, that's crystal clear.
My plan B is to use the callback only to set a flag (to trigger the HTTP Client) and send a 204 response.
Then I'll send the real payload (or any error, depending on the client response) to the browser via a server-sent event.
Hello,
With ESP8266, using HTTP client from inside a ESPAsyncWebServer callback always returns a "connection refused" error.
Same function called from anywhere outside the callback works as expected.
No problem at all with ESP32, both calls return the expected content.
My test code for ESP8266:
And some traces, after pointing my browser at http://esptest.local :
Did I miss something?
Cheers
The text was updated successfully, but these errors were encountered: