I have a server (running on Amazon) and a single client that connects to it. After a connect has been established the client and server exclusively communicate with each other and send messages.
e.g.
1. Client -> Server
2. Client -> Server
3. Client <- Server
4. Client -> Server
5. Client <- Server
6. Client <- Server
The client might lost connectivity and re-connect after some time and resume message sending. Also what are the implications of the order of messages? Could #2 arrive before #1?
Push/pull is best in this situation. It will allow async messaging, but will store messages if a endpoint drops away for a time.
For ordering, ZeroMQ is a abstraction of a FIFO queue and is built over TCP. This will ensure that all messages are passed up to the application in the order that they're received.
To add a bit to the existing answer (as it has an upvoted comment asking for elaboration), one solution could be to set up two sockets on each node. Here's an example where we send messages using
input
while listening for responses on a background thread:server.py
:client.py
: