Hi peeps, hopefully this is the right place to ask this question. I just discovered zmq a couple of days ago while trying to find a networking/message sending solution, and have been reading through the docs and guide. I'm trying to wrap my head around/better understand how to use the different socket types to solve certain scenarios, and was wondering if someone with experience could give their opinion/feedback?
The specific scenario is something like the following (I'm going to make up a scenario related to camera video streams in a house, just to be more concrete):
That roughly sums up the scenario. What I've come up with:
So roughly, something like this:
A client sets up a ZMQ_CLIENT socket, connects to the server, says they want the "kitchen" stream. The server sets up the ZMQ_RADIO socket (if this is first client, otherwise already exists) and the group, and sends the group name to the client. The client then sets up a ZMQ_DISH socket, and begins receiving the stream.
Does this seem like I am following the patterns that zmq sets up in an intended way? If not, any feedback?
Don't share ZeroMQ sockets between threads. ZeroMQ sockets are not threadsafe, while the documentation says
Following are the thread safe sockets: * ZMQ_CLIENT * ZMQ_SERVER * ZMQ_DISH * ZMQ_RADIO * ZMQ_SCATTER * ZMQ_GATHER. These all look like newer/draft socket types, so is it just that the newer ones have been implemented in thread safe manners while the older ones have not?
@sappo Thanks for your help, i'll have to take a look at that. And if you helped write the ZeroMQ guide, you did do an excellent job. It's definitely one of the easier texts i've read
I guess i'm trying to determine if i need a protocol or not. Basically i have 1 client (Router Socket) that needs to send a request to one specific server, with a dealer socket, (There are several servers) to perform some work then send the result back to the client. I figure the router socker can prepend an ID to the message and send it to the specific client. What scenarios would i have to write my own protocol?