[nanomsg] Re: Question on pubsub device

  • From: Bent Cardan <bent@xxxxxxxxxxxxxxxxxxxx>
  • To: "nanomsg@xxxxxxxxxxxxx" <nanomsg@xxxxxxxxxxxxx>
  • Date: Tue, 17 Mar 2015 03:42:10 -0400

That's right, Gonzalo.

The sub socket's default is no subscription. You'll always need to call
setsockopt after creating it to get anything.

Moreover, if we receive all: there's no way to distinguish between the
subscribed set and any unsubscribed set. If that were the default it would
also require a strange maneuver first in all cases to call setsockopt()
method unsubscribing to an empty string before initiating a particular
string subscription!

On Tue, Mar 17, 2015 at 3:26 AM, Gonzalo Diethelm <
gonzalo.diethelm@xxxxxxxxx> wrote:

> From the top of my head, a SUB socket without any subscriptions will get
> no messages at all. This is done this way to avoid flooding a newly
> constructed socket. Anyway, the source is your final friend...
>
> Cheers,
> Gonzalo
>
>
> On Mon, Mar 16, 2015 at 10:52 PM, Garrett D'Amore <garrett@xxxxxxxxxx>
> wrote:
>
>>
>> > On Mar 16, 2015, at 2:45 PM, Benoit Labaere <benoit.labaere@xxxxxxxxx>
>> wrote:
>> >
>> > Putting a device between pub and sub sockets seems to require the sub
>> socket of the device to be subscribed to something, an empty string for
>> example.
>> > Is this the intended behavior, or did I miss some step ?
>>
>> I thought by default sub sockets were subscribed to everything.  But
>> subscribing to an empty string should have that effect as well. :-)
>>
>>         - Garrett
>>
>>
>>
>
>
> --
> Gonzalo Diethelm
> gonzalo.diethelm@xxxxxxxxx
>

Other related posts: