AUTHFAIL和会话超时使用Strophe连接到ejabberd

时间:2015-06-16 06:52:51

标签: xmpp strophe bosh

我在Amazon linux EC2上安装了ejabberd 15.03。我正在使用托管在单独实例上的外部ODBC(MySQL)。带内注册被禁用,我有自己的脚本处理注册。设置工作正常,我能够使用像Psi这样的客户端连接到服务器,并且能够在Android上使用smack连接甚至交换消息问题是http-bind设置。我正在使用Strophe和Angular.js来创建一个Web聊天客户端。这是我的ejabbed.yml:

  

端口:5280       模块:ejabberd_http       request_handlers:          “/ pub / archive”:mod_http_fileserver          “/ http-bind”:mod_http_bind       web_admin:是的       http_poll:false       http_bind:true       ##register:true       captcha:false

我也启用了以下模块:

mod_http_bind:[]

当我使用strophe连接时: myapp.service('xmppAuth',function(){      返回{

auth: function(login, password) {
console.log(login+password);
  alert('connection start');
   connect = new Strophe.Connection('http://example.com:5280/http-bind/');
   connect.connect(login, password, function (status) {
    console.log(status);
       if (status === Strophe.Status.CONNECTED) {
        alert('connected with server');
         var iq = $iq({type: 'get'}).c('query', {xmlns: 'jabber:iq:roster'});
         connect.sendIQ(iq, on_roster);
         connect.addHandler(on_roster_changed,"jabber:iq:roster", "iq", "set");
         connect.addHandler(on_message,null, "message", "chat");
              }
              else
              {
               alert(Strophe.Status);
               console.log(Strophe.Status);
              }

       })

我收到的是状态4,即AUTHFAIL。知道我可能缺少什么。当我在浏览器中访问http-bind网址时,我会收到: ejabberd mod_http_bind

  

XMPP over BOSH(XEP-0206)

的实现

此网页仅供参考。

要使用HTTP-Bind,您需要一个支持它的Jabber / XMPP客户端。

ejabberd.log: https://drive.google.com/file/d/0B-YNcaCq5wozN0hGQ2xWUHJ0b1U/view?usp=sharing

1 个答案:

答案 0 :(得分:0)

问题已经解决。错过了很明显的东西。 XMPP帐户密码是一个整数,我猜连接函数不会将其识别为字符串,因此不匹配和身份验证失败。

相关问题