I'd like to share a package that uses a single TCP connection to a ESP32 (tested) / whatever else runs networked MicroPython (untested) device, which carries
- keepalive and watchdog
- FUSE and file access commands (FUSE works, the rest is TODO but very simple to add)
- MQTT messages
- REPL
- well … whatever else you want, it's extensible
- it runs completely in the background so you still have the REPL
- if the link is dead, then it's really dead, no more partial breakdowns
- if you need SSL or authentication (TODO) you only need one SSL connection
- the protocol is simple, many languages have msgpack libraries
- there's a code example: forward a debounced button to MQTT
- it uses the standard msgpack code, which is not at all memory efficient (but I'll fix that soon)
- support for reconnecting things after a network outage is somewhat incomplete (but works for most usecases IMHO)
It's possible to run this code across a UART line: just add checksumming and retransmission. If somebody knows of a light-weight library that does this, extending microfuse to support it should be easy.
Code at https://github.com/M-o-a-T/microfuse