def receive(**options)
      message = ''
      @socket.recv_string message

      message = message.match(/^(?<topic>[^\ ]*)\ (?<body>.*)/m)

      decoded = (options[:decode] || @decode).call message['body']
      if block_given?
        yield decoded, message['topic']
      else
        [decoded, message['topic']]
      end
    end
def receive(**options)
      message = ''
      @socket.recv_string message

      message = message.match(/^(?<topic>[^\ ]*)\ (?<body>.*)/m)

      decoded = (options[:decode] || @decode).call message['body']
      if block_given?
        yield decoded, message['topic']
      else
        [decoded, message['topic']]
      end
    end
Creates a new Subscriber socket.

 @note The default behaviour is to output and messages received to STDOUT.

 @param [:bind, :connect] mode (:connect) a mode for the socket.
 @param [Hash] options optional parameters.
 @option options [String] topic a topic to subscribe to.
 @see EZMQ::Socket EZMQ::Socket for optional parameters.

 @return [Publisher] a new instance of Publisher.

 Receive a message from the socket.

 @note This method blocks until a message arrives.

 @param [Hash] options optional parameters.
 @option options [lambda] decode how to decode the message.

 @yield [message, topic] passes the message body and topic to the block.
 @yieldparam [Object] message the message received (decoded).
 @yieldparam [String] topic the topic of the message.

 @return [Object] the message received (decoded).