def update_listen_state(state, interval = 0)
      if state == :cancel
        @listen_timer.cancel if @listen_timer
        @listen_timer = nil
        @listen_state = state
      elsif [:choose, :check, :connect, :long_poll, :wait].include?(state)
        @listen_checks = 0 if state == :check && @listen_state != :check
        @listen_state = state
        @listen_interval = interval
      else
        raise ArgumentError, "Invalid listen state: #{state.inspect}"
      end
      true
    end
def update_listen_state(state, interval = 0)
      if state == :cancel
        @listen_timer.cancel if @listen_timer
        @listen_timer = nil
        @listen_state = state
      elsif [:choose, :check, :connect, :long_poll, :wait].include?(state)
        @listen_checks = 0 if state == :check && @listen_state != :check
        @listen_state = state
        @listen_interval = interval
      else
        raise ArgumentError, "Invalid listen state: #{state.inspect}"
      end
      true
    end
Update listen state

 @param [Symbol] state next
 @param [Integer] interval before next listen action

 @return [TrueClass] always true

 @raise [ArgumentError] invalid state