title: onFailure function in mqtt javascript client
body: <p>I am using mqtt paho javascript client library to connect to an 
  mqtt server,i am able to connect to server with username and password, now the issue is ...how can i warn user if he gives wrong username or password.<a href="https://eclipse.org/paho/clients/js/" rel="nofollow noreferrer">i followed this link</a>
  is there any onFailure function to report an error if user credentials are wrong??</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>client.connect({onSuccess:this.onConnect.bind(this),userName:Name,password:Password},{onFailure:console.log("failed")});
  
  
  
    onConnect() {
    // Once a connection has been made, make a subscription and send a message.
    console.log("onConnect");
    
    }</code></pre>
  </div>
  </div>
  </p>
  
  <blockquote>
    <p>even though I am able to connect , I can see but "onConnect" and "failed" messages in my console</p>
  </blockquote>