def long_poll(routing_keys, ack, &handler)
      raise ArgumentError, "Block missing" unless block_given?

      params = {
        :wait_time => @options[:listen_timeout] - 5,
        :timestamp => Time.now.to_f }
      params[:routing_keys] = routing_keys if routing_keys
      params[:ack] = ack if ack && ack.any?

      options = {
        :request_timeout => @connect_interval,
        :poll_timeout => @options[:listen_timeout] }

      event_uuids = []
      events = make_request(:poll, "/listen", params, "listen", options)
      if events
        events.each do |event|
          event = SerializationHelper.symbolize_keys(event)
          Log.info("Received EVENT <#{event[:uuid]}> #{event[:type]} #{event[:path]} from #{event[:from]}")
          @stats["events"].update("#{event[:type]} #{event[:path]}")
          event_uuids << event[:uuid]
          handler.call(event)
        end
      end
      event_uuids if event_uuids.any?
    end
def long_poll(routing_keys, ack, &handler)
      raise ArgumentError, "Block missing" unless block_given?

      params = {
        :wait_time => @options[:listen_timeout] - 5,
        :timestamp => Time.now.to_f }
      params[:routing_keys] = routing_keys if routing_keys
      params[:ack] = ack if ack && ack.any?

      options = {
        :request_timeout => @connect_interval,
        :poll_timeout => @options[:listen_timeout] }

      event_uuids = []
      events = make_request(:poll, "/listen", params, "listen", options)
      if events
        events.each do |event|
          event = SerializationHelper.symbolize_keys(event)
          Log.info("Received EVENT <#{event[:uuid]}> #{event[:type]} #{event[:path]} from #{event[:from]}")
          @stats["events"].update("#{event[:type]} #{event[:path]}")
          event_uuids << event[:uuid]
          handler.call(event)
        end
      end
      event_uuids if event_uuids.any?
    end
Make long-polling request to receive one or more events
 Do not return until an event is received or the polling times out or fails

 @param [Array, NilClass] routing_keys as strings to assist router in delivering
   event to interested parties
 @param [Array, NilClass] ack UUIDs for events received on previous poll

 @yield [event] required block called for each event received
 @yieldparam [Object] event received

 @return [Array, NilClass] UUIDs of events received, or nil if none

 @raise [ArgumentError] block missing