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
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:
ulno#ulnoiot:$ mpfshell --loglevel DEBUG --logfile /tmp/mpfshell.log
** Micropython File Shell v0.8.0, [email protected] **
-- Running on Python 3.5 using PySerial 3.3 --
mpfs [/]> open ws:192.168.12.57,ulnoiot
Connected to esp8266
mpfs [/]> close
mpfs [/]> open ws:192.168.12.57,ulnoiot
Failed to open: ws:192.168.12.57,ulnoiot
mpfs [/]> open ws:192.168.12.57,ulnoiot
Connected to esp8266
mpfs [/]> open ws:192.168.12.57,ulnoiot
Failed to open: ws:192.168.12.57,ulnoiot
mpfs [/]> open ws:192.168.12.57,ulnoiot
Connected to esp8266
mpfs [/]> exit
The corresponding debug.log
tail -f /tmp/mpfshell.log
2017-04-27 13:48:08,883 INFO Micropython File Shell v0.8.0 started
2017-04-27 13:48:08,883 INFO Running on Python 3.5 using PySerial 3.3
2017-04-27 13:48:27,619 INFO websocket connected to ws://192.168.12.57:8266
2017-04-27 13:48:34,338 INFO websocket closed
2017-04-27 13:48:35,957 ERROR websocket error: Connection is already closed.
2017-04-27 13:48:35,962 INFO websocket closed
2017-04-27 13:48:40,807 ERROR
2017-04-27 13:48:57,758 INFO websocket connected to ws://192.168.12.57:8266
2017-04-27 13:49:04,248 INFO websocket closed
2017-04-27 13:49:04,275 ERROR websocket error: Connection is already closed.
2017-04-27 13:49:04,281 INFO websocket closed
2017-04-27 13:49:09,249 ERROR
2017-04-27 13:49:23,899 INFO websocket connected to ws://192.168.12.57:8266
2017-04-27 13:49:28,621 INFO websocket closed
The text was updated successfully, but these errors were encountered:
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?
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
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
The text was updated successfully, but these errors were encountered: