Approach
I'm building an asynchronous IM/chat application with ZeroMq, just as a learning exercise, using the following approach.
The server uses two ROUTER sockets, similar to lbbroker.java
, reading from incoming
and writing to outgoing
, while manipulating the envelope for delivery to the intended receiver.
Clients set a unique identity with socket.setIdentity()
, and use PULL and PUSH sockets, instead of REQ/REP, for sending and receiving chat messages asynchronously. I've built and tested the code, everything appears to work fine.
Questions
Is the use of PUSH/PULL with ROUTER a valid approach?
Why do chat clients become unreachable when dropping off then reconnecting?
Sally becomes unreachable if she disconnects then reconnects, she can no longer receives chat messages. After debugging the server, I confirmed it's definitely sending messages with the correct envelope to sally. I also used outgoing.setRouterMandatory(true)
to ensure unaddressable messages weren't being dropped by the server, but no errors got raised.