peterhinch / micropython-mqtt

A 'resilient' asynchronous MQTT driver. Recovers from WiFi and broker outages.
MIT License
549 stars 116 forks source link

MicroPython Unix port compatibility #119

Open paravoid opened 10 months ago

paravoid commented 10 months ago

I'm trying to use the MicroPython Unix port to quickly iterate on changes locally (sometimes with test fixtures etc.) before pushing them to the microcontroller. For that purpose I'd like the code to be as closer as to the one running on the microcontroller, so using MicroPython rather than CPython, and this module, rather than conditionally switching to something like Paho.

That doesn't work out of the box, as far as I can tell for two reasons:

CPython compatibility would also be nice, but that feels like a larger endeavor so explicitly keeping it out of scope for this issue.

peterhinch commented 10 months ago

I fully accept the limitations of this library. You might like to read this short doc which provides background and advocates a complete redesign. For this reason I don't plan to implement half-way-house incremental changes (although I fully support the existing code).

For personal reasons I'm not in a position to undertake a full redesign. The MicroPython maintainers have discussed MQTT in the past but I don't know if it's on their roadmap.

zcattacz commented 6 months ago

@paravoid , you can try my fork of mqtt_as.py. It's a stripped down version to work for both micropython-unix and cpython.