Socket.subscribe

Establishes a message filter.

  1. void subscribe(ubyte[] filterPrefix)
  2. void subscribe(char[] filterPrefix)
    struct Socket
    @safe
    void
    subscribe
    (
    const char[] filterPrefix
    )
  3. this(SocketType type)
  4. this(Context context, SocketType type)

Throws

ZmqException if $(ZMQ) reports an error.

Corresponds to

$(ZMQREF zmq_msg_setsockopt()) with ZMQ_SUBSCRIBE.

Examples

// Create a subscriber that accepts all messages that start with
// the prefixes "foo" or "bar".
auto sck = Socket(SocketType.sub);
sck.subscribe("foo");
sck.subscribe("bar");

Meta