title: ejabberd XMPP connection failed using strophejs
body: <p>I am trying to run <a href="https://github.com/metajack/profxmpp/tree/master/ch03" rel="nofollow">THIS XMPP JS</a> code using ejabberd on server side. Here is my connection code:</p>
  
  <pre><code>$(document).bind('connect', function (ev, data) {
      console.log("connect "+JSON.stringify(data));
      var conn = new Strophe.Connection("http://localhost:5280/http-bind");
  
      conn.connect(data.jid, data.password, function (status) {
          console.log("status"+status);
          if (status === Strophe.Status.CONNECTED) {
              $(document).trigger('connected');
          } else if (status === Strophe.Status.DISCONNECTED) {
              $(document).trigger('disconnected');
          }
      });
  
      Hello.connection = conn;
  });
  </code></pre>
  
  <p>I am getting <code>status = 1</code>. and after few time later it starts keep showing :
  <code>Uncaught Error: 11, flXHR::abort(): Failed, The abort() call failed to complete.</code></p>
  
  <p>My ejabberd is running on <code>http://localhost:5280/admin/</code> and <code>admin@ejab</code> is admin user.</p>
  
  <p>Here is full code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Strophe.js Basic Example&lt;/title&gt;
      &lt;script src='http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js'&gt;&lt;/script&gt;
      &lt;script src='../strophe.js'&gt;&lt;/script&gt;
  &lt;!--    &lt;script src='scripts/flXHR.js'&gt;&lt;/script&gt;
      &lt;script src='scripts/strophe.flxhr.js'&gt;&lt;/script&gt;--&gt;
      &lt;script src='basic.js'&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id='login' style='text-align: center'&gt;
        &lt;form name='cred'&gt;
          &lt;label for='jid'&gt;JID:&lt;/label&gt;
          &lt;input type='text' id='jid'&gt;
          &lt;label for='pass'&gt;Password:&lt;/label&gt;
          &lt;input type='password' id='pass'&gt;
          &lt;input type='button' id='connect' value='connect'&gt;
        &lt;/form&gt;
      &lt;/div&gt;
      &lt;hr&gt;
      &lt;div id='log'&gt;&lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><code>basic.js</code></p>
  
  <pre><code>var BOSH_SERVICE = 'http://localhost:5222/http-bind';
  var connection = null;
  
  function log(msg) 
  {
      $('#log').append('&lt;div&gt;&lt;/div&gt;').append(document.createTextNode(msg));
  }
  
  function rawInput(data)
  {
      log('RECV: ' + data);
  }
  
  function rawOutput(data)
  {
      log('SENT: ' + data);
  }
  
  function onConnect(status)
  {
      if (status == Strophe.Status.CONNECTING) {
      log('Strophe is connecting.');
      } else if (status == Strophe.Status.CONNFAIL) {
      log('Strophe failed to connect.');
      $('#connect').get(0).value = 'connect';
      } else if (status == Strophe.Status.DISCONNECTING) {
      log('Strophe is disconnecting.');
      } else if (status == Strophe.Status.DISCONNECTED) {
      log('Strophe is disconnected.');
      $('#connect').get(0).value = 'connect';
      } else if (status == Strophe.Status.CONNECTED) {
      log('Strophe is connected.');
      connection.disconnect();
      }
  }
  
  $(document).ready(function () {
      connection = new Strophe.Connection(BOSH_SERVICE);
      connection.rawInput = rawInput;
      connection.rawOutput = rawOutput;
  
      $('#connect').bind('click', function () {
      var button = $('#connect').get(0);
      if (button.value == 'connect') {
          button.value = 'disconnect';
  
          connection.connect($('#jid').get(0).value,
                     $('#pass').get(0).value,
                     onConnect);
      } else {
          button.value = 'connect';
          connection.disconnect();
      }
      });
  });
  </code></pre>
  
  <p>ouput is :</p>
  
  <pre><code>Strophe is connecting.
  SENT: &lt;body rid='745165534' xmlns='http://jabber.org/protocol/httpbind' to='ejab' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/&gt;
  </code></pre>