Connection failure when using strophe with ejabberd bosh to connect to jid account on localhost

倖福魔咒の 提交于 2019-12-09 19:00:53

问题


I have installed ejabberd on my machine and its running fine.

localhost:5280/admin

localhost:5280/http-bind

It is also displaying "ejabberd mod_http_bind An implementation of XMPP over BOSH (XEP-0206)" I guess it's working fine.

When I try to create a connection with Strophe I get the connection status as CONNFAIL.

My code goes as follow :

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 !!');

}}

I keep getting CONNFAIL.

I have also added proxypass forhttp://localhost:5280/http-bind in apache httpd.conf file.

I am not able to figure out what is the problem.


回答1:


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.

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>

Note: I assumed standard installation paths for ejabberd.cfg and ejabberd.log. If you have an alternate install prefix, kindly update the paths accordingly.



来源:https://stackoverflow.com/questions/13166950/connection-failure-when-using-strophe-with-ejabberd-bosh-to-connect-to-jid-accou

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!