jonnydee/nzmqt

receiving messages from PyZMQ

Closed this issue · 5 comments

I am trying to use the PUB/SUB pattern between a PyZMQ (python binding of zeroMQ) and nzmqt.
But I am not able to subscribe to messages comming from PyZMQ since the string format of the messages differ.
PyZMQ message: "topic message"
nzmqt: "MSG[topic: message]"
Is there a workaround for this or is it simply impossible to let PyZMQ and nzmqt talk to each other via PUB/SUB?

@FaisalZ We are using nzmqt and PyZMQ in Machinekit without problems:
Take a look at
https://github.com/machinekit/machinekit/blob/master/src/machinetalk/mkwrapper/mkwrapper.py#L1786
https://github.com/strahlex/QtQuickVcp/blob/master/src/application/qapplicationstatus.cpp#L393

EDIT: We are using XPUB on the server side to get noticed when someone subscribe. To encode message we use Google Protocol Buffers.

Yes I used your PUB/SUB example as reference. How do you then subscribe to to a topic from a python server, that does not follow the mentioned message pattern of the example?

@FaisalZ nzmqt returns a list of QByteArrays containing the message parts. The first one is usually the topic, see my example above. https://github.com/strahlex/QtQuickVcp/blob/master/src/application/qapplicationstatus.cpp#L222

Thanks for the comments. I got it working now. The "problem" was indeed that I thought the topic was not included in the normal message.