[zeromq-dev] XPub welcome message and manual subscriptions

Doron Somech somdoron at gmail.com
Wed Nov 26 14:30:03 CET 2014

Hi All,

Just want to let you know and have a discussion on two features (two
solutions to problems) that I have just added to zeromq:

*Manual Subscriptions:*
Publisher can be configured to manual mode, with manual mode subscriptions
send from the client are not added automatically (nor unsubscriptions) and
user must call set socket option with ZMQ_SUBSCRIBE on the publisher side
to confirm them.

The idea is that now subscriptions can be confirmed according to
credentials, another use is to actually use a token for the subscription
and the publisher will translate the token to one or more topics. For the
second use the subscriber side must be of type xsub to avoid filtering
messages on the client side.

You can take a look at the test for usage:

*Welcome message:*
Publisher can be configured to send welcome message when subscriber is

This solves the problem of not knowing if the connect action succeed, after
connecting we wait for X seconds for a welcome message, if not arrived we
know the publisher is down.

I know this can also be solved with heartbeat but then you have to wait up
to the heartbeat interval (and probably double the interval to make sure).

Another nice use it to find the closest publisher, if I have multiple
publishers around the world client can try to connect to all, the first one
to answer with welcome is probably the closest one (alternative to geodns).

When using the welcome feature the client must subscribe for the welcome
message before trying to connect and server must use xpub, poll for
incoming subscriptions and read them(subscriptions can be ignored).

You can take a look at the test for usage:


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20141126/6851a205/attachment.htm>

More information about the zeromq-dev mailing list