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

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
User avatar
WZab
Posts: 25
Joined: Tue Jan 21, 2020 7:45 pm

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

Post by WZab » Sun Jul 18, 2021 10:11 pm

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.

User avatar
WZab
Posts: 25
Joined: Tue Jan 21, 2020 7:45 pm

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

Post by WZab » Tue Jul 20, 2021 8:01 pm

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


stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

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

Post by stijn » Wed Jul 21, 2021 7:09 am

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?

Post Reply