Reputation: 311275
ZeroMQ defines a series of socket types, commonly referred to as SUB
, PUB
, XSUB
, XPUB
, DEALER
...
Looking through some API code, there are methods such as XSend
, XHasIn
, XHiccupped
.
These X
characters seem to be used as semantic modifiers. Is there any pattern or significance to their usage?
Upvotes: 0
Views: 69
Reputation: 13766
When applied to socket types, the x
is a signifier that the socket exposes the raw elements of the protocol in some way that is otherwise hidden by the more common socket type.
Take, for example, xSUB & xPUB.
PUB/SUB typically only communicates one way, PUB sends and SUB receives. But with xPUB/xSUB, the otherwise hidden element of the protocol is exposed: xSUB sends a "subscribe" message to xPUB, and xPUB can receive that message and you can see it to act on it in some more interesting way than just maintaining and sending data for that subscription.
Likewise, there used to be xREP and xREQ. In ZMQ, REP/REQ have very strict requirements for the order in which they send/receive messages. These requirements are enforced by low level elements of the socket protocols which are not exposed. xREP and xREQ allowed you to break those requirements by exposing the elements that forced you to follow those message patterns. These socket types were so useful, they eventually evolved into ROUTER and DEALER sockets.
I haven't looked at a low enough level to say exactly why there are methods like xsend
& etc, but my gut feeling is that they are the versions of these methods in the x
socket types that are designed to expose these protocol elements.
Upvotes: 1