noob question: correct way to write message in route protocol
- Ngôn ngữ chính
- Python
- Star
- 431
- Fork
- 57
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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 `: [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.
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.