-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: return values from http.post callback #2979
Comments
This is essentially how event-driven/reactive/asynchronous programming works. |
okay thanks for clarification, i saw there is an option in the http module on the dev-esp32 branch to switch between asynchronous and synchronous http connections. |
For ESP32 the Espressif ESP-IDF provides an HTTP client: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/protocols/esp_http_client.html. The NodeMCU module is "just" a firmware API adapter. |
Thanks, in case someone else also needs synchronous http requests for i.e. running dsleep after all data is send, here are my two solutions in non tested pseudo code: Solution 1 (nested function)
Solution 2 state management
|
I worked on the state management example and tada it won't work. Long story short, for some reasons the second time you call http.post the callback will not be called anymore! After endless hours i found this line in the documentation
Nice, so basically i can do asynchronous http request but not concurrent... Related tickets are here #1293 #1258 and #1629 Please could you fix this somehow? |
Missing feature
i need the return value from the http.post callback
instead http.post always returns nil, even the callback function returns a value.
Justification
Here are a real world use case for this:
Workarounds
The only possible workaround i can think of is to run the post function inside the http post callback.
The text was updated successfully, but these errors were encountered: