使用Strophe js(CONNFAIL)连接到Prosody XMPP服务器

时间:2015-08-07 19:28:08

标签: javascript xmpp strophe bosh

我在example.com上设置了一个韵律服务器。我可以使用pidgin和网址http://example.com:5280/http-bind连接到bosh服务,也可以在broswer上使用相同的网址回复:

  

有效!现在将您的BOSH客户端指向此URL以进行连接   韵律。

     

有关更多信息,请参阅Prosody:设置BOSH。

现在我尝试使用以下命令

new Strophe.Connection("http://example:5280/http-bind/").connect("admin@example.com", "123456", callback);

其中回调是fuction(status)我用来记录连接。回调状态首先是 Strophe.CONNECTING ,然后是 Strophe.CONNFAIL

我已经在韵律上启用了调试日志级别,/var/log/prosody/prosody.debug没有添加新条目(它在pidgin上工作正常)。

此外,我已通过在apache2 virtualhost

上添加以下行来修复代理
<Location /http-bind>
    Order allow,deny
    Allow from all
</Location>
RewriteEngine On
RewriteRule ^/http-bind$ http://example.com:5280/http-bind [P,L]

我注意到在pidgin上我必须启用纯文本身份验证才能使其正常工作,并且我在/etc/prosody/prosody.cfg.lua上进行了以下设置(我有更多但这些似乎相关)

c2s_require_encryption = false
s2s_secure_auth = false
authentication = "internal_plain"

以及以下BOSH设置

consider_bosh_secure = true
cross_domain_bosh = true

起初,我认为问题是加密,但是,因为没有我丢失的日志条目。您是否知道问题可能是什么,您认为我还应该包含更多信息吗?

1 个答案:

答案 0 :(得分:1)

"http://example:5280/http-bind/""http://example.com:5280/http-bind"的网址不同。你应该删除尾部斜杠。