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

noob question: correct way to write message in route protocol #127

Open
coinicon72 opened this issue Oct 6, 2017 · 0 comments
Open

noob question: correct way to write message in route protocol #127

coinicon72 opened this issue Oct 6, 2017 · 0 comments

Comments

@coinicon72
Copy link

I'm new to python/pyzmq/aiozmq, so this maybe a very basic question for you guys, thanks.

I tried the very first example from doc, http://aiozmq.readthedocs.io/en/v0.8.0/examples.html#simple-dealer-router-pair-implemented-on-core-level , works just fine.

When I inspected the message msg received from the dealer (at ZmqRouterProtocol::msg_received) and found the value of message was <class 'list'>: [b'\x00\x80\x00\x00)', b'data', b'ask', b'0'], which has a extra element at position 0.

Then, I changed source code slightly, tried to send back message like this:
# self.transport.write(msg) # comment out the original code
self.transport.write([b'hello']) # change to this line
But this does no working, the dealer can't get any response.

Turns out I need sent message like this:
self.transport.write([msg[0], b'hello']) # add extra head to send message correctly
this just no feel right

So, my question is:

  1. why there's a extra head (first element) in the message received in router
  2. what's the right way to send message in router

Thanks in advance.

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

1 participant