Closed dukeduck1984 closed 4 years ago
Ok, I think I figured out why - when I connected directly to the ESP32's own AP (visiting via 192.168.4.1), the above code worked. It won't work if the ESP32 connects to my home wifi and I visit the ESP32 through home wifi.
But is there a workaround?
Hi @dukeduck1984, A httpResponse is sent trought the current TCP/IP(HTTP) persistent connection. If the main WLAN interface changes, the connection is broken. It's normal. Could you try my WLAN lib to play with the two interfaces : https://github.com/jczic/MicroWifi (no help but some simple functions). You can scan APs, connect to an AP, during a connection from a station 👍
Thanks @jczic , I will give MicroWifi a try.
Hi,
I have an API which is used to connet/reconnet to a Wifi AP, I wanted this API to WriteResponseOK after the connection is established, however it does send back any response even though the connection was made. For other APIs in my code, httpResponse worked flawlessly, so I think it may be related to wlan methods.
This is the API.
So the above API gets a post request with below json data:
Below is the wifi.sta_connect() method:
In the REPL I can see the connection was successfully made, then it just got stuck right at where
httpResponse.WriteResponseOk()
is, in the browser console, that request was in pending status until timeout.What can be the issue?
Firmware: MicroPython v1.11-240-g519746cae on 2019-08-26; ESP32 module (spiram) with ESP32
Thanks. Kaiyuan