Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

receiving messages from PyZMQ #29

Closed
FaisalZ opened this issue Apr 21, 2015 · 5 comments
Closed

receiving messages from PyZMQ #29

FaisalZ opened this issue Apr 21, 2015 · 5 comments

Comments

@FaisalZ
Copy link

FaisalZ commented Apr 21, 2015

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?

@jonnydee
Copy link
Owner

jonnydee commented Apr 21, 2015 via email

@machinekoder
Copy link
Collaborator

@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.

@FaisalZ
Copy link
Author

FaisalZ commented Apr 21, 2015

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?

@machinekoder
Copy link
Collaborator

@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

@FaisalZ
Copy link
Author

FaisalZ commented Jul 21, 2015

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.

@FaisalZ FaisalZ closed this as completed Jul 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants