Open ulno opened 7 years ago
So, I assume, the module, I need to look at is mpfshell/mp/conwebsock.py. Would it be hard to at least enable some kind of auto-reconnect/retry? Maybe off by default but some kind of wsretry-flag you could give on the command line. Would it make sense to just play with the timeout? I still just don't understand why mpfshell fails so often and webrepl doesn't? Maybe the websocket handling in python is different than in javascript? I don't see any special code handling errors in the java script part.
Micropython (https://github.com/micropython/webrepl) provides the python command-line client (webrepl-cli.py) which even does a super simple manual websocket handling (in websocket-helper.py). Maybe using that would increase stability?
Thoughts?
ulno
I took a closer look and it seems that switching to raw repl mode messes up the micropython repl. A webrepl reset at connection close seems to fix it.
Here is my current testing fork, there is still a bit too much debug prints in there, but if you feel like testing, check it out: https://github.com/ulno/mpfshell
Have you gotten anywhere with this? Websocket connections are currently very flaky and I'd like to fix that.
Connecting to webrepl via the ws option of mpfshell seems a little less reliable than using webrepl from https://github.com/micropython/webrepl.
Connecting the first time to freshly booted esp8266 usually seems to work (even if I have the feeling that it also sometimes fails when the wireless connection is weak - don't have proof for that yet). However, re-opening the websocket or even closing and re-connecting usually does not work the first time. A second re-connect often succeeds.
The webrepl web frontend seems to work nearly always (only sometimes fails when I used mpfshell in between).
Any idea why this is? What is done differently? Can this be fixed or circumvented?
A transcript of my testsession looks like this:
The corresponding debug.log