问题描述
我已经在计算机上安装了ejabberd,并且运行良好。
I have installed ejabberd on my machine and its running fine.
localhost:5280/admin
localhost:5280/http-bind
它还显示 ejabberd mod_http_bind XMPP的实现BOSH(XEP-0206),我想它工作正常。
It is also displaying "ejabberd mod_http_bind An implementation of XMPP over BOSH (XEP-0206)" I guess it's working fine.
当我尝试与Strophe创建连接时,连接状态为 CONNFAIL
。
When I try to create a connection with Strophe I get the connection status as CONNFAIL
.
我的代码如下:
var conn = new Strophe.Connection('http://localhost:5280/http-bind');
conn.connect(data.jid, data.password, function (status) {
// jid=user@localhost
if(status===Strophe.Status.CONNECTING){
alert('connecting...!!');
}
if(status===Strophe.Status.AUTHFAIL){
alert('auth failure...!!');
}
if(status===Strophe.Status.CONNFAIL){
alert('connection falied !!');
}}
我一直收到 CONNFAIL
。
我还在Apache httpd.conf文件中为 http:// localhost:5280 / http-bind
添加了proxypass。
I have also added proxypass forhttp://localhost:5280/http-bind
in apache httpd.conf file.
我无法找出问题所在。
推荐答案
调试ejabberd是否真的收到了你的Bosh请求,使用 {log_level,5}
重新启动ejabberd(将其设置在 /etc/ejabberd/ejabberd.cfg
文件中)。然后,当您使用strophe连接到ejabberd时,通过执行 tail -f / va来监视日志r / log / ejabberd / ejabberd.log
。如果您看不到任何内容,则表示您的请求在代理上下文中某处失败。如果您确实看到了某些内容,请使用相关日志更新您的问题,以帮助我们更好地解决问题。
To debug whether ejabberd is really receiving your Bosh requests, restart ejabberd with {log_level, 5}
(set this inside your /etc/ejabberd/ejabberd.cfg
file). Then as you are making connection to ejabberd using strophe, watch for logs by doing tail -f /var/log/ejabberd/ejabberd.log
. If you don't see anything, it means your requests are failing somewhere within proxy context. If you do see something, kindly update your question with relevant logs for us to help you out better.
或者,您可以更新 log_level
通过ejabberd调试shell进行中:
Alternately you can update log_level
on the fly via ejabberd debug shell:
$ sudo ejabberdctl debug
....
Eshell V5.8.5 (abort with ^G)
(ejabberd@localhost)1> ejabberd_loglevel:set(5).
{module,ejabberd_logger}
(ejabberd@localhost)2>
注意:我假定的标准安装路径ejabberd.cfg
和 ejabberd.log
。如果您有备用安装前缀,请相应地更新路径。
Note: I assumed standard installation paths for ejabberd.cfg
and ejabberd.log
. If you have an alternate install prefix, kindly update the paths accordingly.
这篇关于将strophe与ejabberd bosh结合使用以连接到本地主机上的jid帐户时出现连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!