-
Notifications
You must be signed in to change notification settings - Fork 485
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
Valid to use PULL/PUSH with ROUTER socket? #81
Comments
PUSH/PULL is valid to use with ROUTER. But I would recommend to use DEALER as a counter part of ROUTER. By using a single DEALER at the client side, you can send and receive message to/from server. It might be easier to implement. |
Hi Dongmin, My client uses 2 threads; one for PUSHing messages, and another for PULLing; works great since everything on the client is async. If I switch to a single DEALER, I still need two threads on the client, and the guide says to never reuse sockets across threads. Can I break that rule if one thread always receives while the other thread always sends on the same DEALER socket? Otherwise, I don't see how this can be accomplished, but I'm open to suggestions. |
I like a pattern using an agent. A sending thread sends messages to the agent through a pipe(INPROC socket), which ZThread.fork do a magic for you. You can use a separate receiving thread and pipe or utilize the sending thread for receiving. A sudo code of would be
Please refere chapter4 of the guide and https://github.com/imatix/zguide/blob/master/examples/Java/flcliapi.java for the agent pattern, or zyre https://github.com/zeromq/zyre/tree/master/java |
Very nice, and I just got this code from irc, so from these examples I am in good shape, thank you |
Hi Raffian...were you able to get it running fully? |
Is PUSH/PULL valid to use with ROUTER? There's no mention of such a socket combo in the guide, I found no examples either.
I'm building a chat/im program, the server uses ROUTER/ROUTER, the clients use PUSH/PULL for sending and receiving messages from server. I also use client identities so the server can route messages to specific clients (for private chat, etc). It appears to work fine in my testing. I just want to know if this is a valid approach.
The text was updated successfully, but these errors were encountered: