Page 1 of 1

ZeroMQ, nanomsg or nng ported to MicroPython (or any good message encapsulation library)?

Posted: Sun Jul 18, 2021 10:11 pm
by WZab
Has anybody successfully ported ZeroMQ, nanomessage or nanomessage-ng to MicroPython?
The idea is to use it for efficient RPC communication via network, with a node running MicroPython (e.g., controlling certain sensors or actuators).

I have prepared a version based on MessagePack+ZeroMQ, that may be used with standard Python running on embedded Linux systems - https://gitlab.com/WZab/python-versatil ... ck-zmq/src . Currently it allows access from C++, Lua, Octave (probably also Matlab?) and of course Python.

When porting it to MicroPython, I have finally managed to get the reasonable subset of MessagePack working - viewtopic.php?f=15&t=10827 , but up to now I was not able to get the ZeroMQ, nanomessage or pynng running on the MicroPython. Unfortunately, the MessagePack that I could use does not support incremental feeding of the unpacker (which I used in the very first implementation - https://ftp.funet.fi/pub/archive/alt.sources/2722.gz ).

Thence, only the JSON-based version, using EOL as a separator is available (which results in seriously increased network occupancy). It is available at https://gitlab.com/WZab/python-versatil ... on-eol/src .

As soon as the a good portable and MicroPython-compatible library for encapsulation of messages is available, we may implement the RPC for communication with µP-based nodes.

Re: ZeroMQ, nanomsg or nng ported to MicroPython (or any good message encapsulation library)?

Posted: Tue Jul 20, 2021 8:01 pm
by WZab
At the moment I have given up the idea of porting 0MQ, nanonmsg or nng. Instead I have used a simplistic encapsulation of the MessagePack-encapsulated messages: each message is prepended by its 4-byte big-endian length.
The implementation has been tested on NUCLEO F767-ZI. It is available in https://gitlab.com/WZab/python-versatil ... sgpack-tcp

Re: ZeroMQ, nanomsg or nng ported to MicroPython (or any good message encapsulation library)?

Posted: Wed Jul 21, 2021 6:20 am
by pythoncoder

Re: ZeroMQ, nanomsg or nng ported to MicroPython (or any good message encapsulation library)?

Posted: Wed Jul 21, 2021 7:09 am
by stijn
I have a subset of ZeroMQ ported (and msgpack from https://github.com/msgpack/msgpack-pyth ... er/msgpack but that is not exactly microcontroller material), would work for any port which has a working C++-14 compiler and which can build libzmq. It's not particularily hard, but ZeroMQ isn't exactly minimal either. Why did you give up on it specifically?