BOSH模块未启动:Ejabberd/Strophe设置问题

Sam*_*ody 8 xmpp ejabberd strophe

我试图使用内部Ejabberd网络服务器在Ubuntu 12(Linode最新版本)上使用Ejabberd设置Strophe来进行聊天.

测试网址(http-bindadmin)都有效.
JWChat有效.
Strophe抛出一个错误:

In Strophe:
RECV: <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='internal-server-error'>BOSH module not started</body>

In ejabberd.log:  
E(<0.468.0>:ejabberd_http_bind:1236) : 
You are trying to use BOSH (HTTP Bind) in host "admin", but the module mod_http_bind is not started in that host. 
Configure your BOSH client to connect to the correct host, or add your desired host`
Run Code Online (Sandbox Code Playgroud)

安装很简单(虽然花了很长时间才能解决这个问题):

  1. 使用sudo apt-get安装
  2. 在sudo下运行
  3. 使用内部服务器,以避免搞乱代理或设置PunJab.
  4. 在ejabberd.cfg做了改动.

对ejabberd.cfg的更改:

%% In listening ports, amended the following lines:  
{ request_handlers,  [   
   {["pub"], mod_http_fileserver},   
   {["http-bind"], mod_http_bind}  
]},  

%% In modules, added the following:  
{ mod_http_fileserver, [   
   {docroot, "/var/lib/ejabberd/www"},   
   {accesslog, "/var/log/ejabberd/access.log"}   
]},  
{mod_http_bind,  []},
Run Code Online (Sandbox Code Playgroud)

任何帮助将非常感激.

Sam*_*ody 6

答案很明显.

Strophe需要以下格式的用户名:

username @ host
eg.admin@example.com

否则假定用户名实际上是主机,并且因为这样的主机不存在,所以它会抛出错误 mod_http_bind is not started in that host

这个错误充其量只是误导,但它在技术上解释了这个问题.
我试图使用用户名[在JWChat中正常工作]登录,因此问题.

如果这不起作用,请检查一些其他要验证的清单:

  1. 确保您的域已添加到/ etc/hosts

    127.0.0.1    localhost.localdomain   localhost
    12.34.56.78  squire.example.com  squire
    
    Run Code Online (Sandbox Code Playgroud)
  2. 确保将您的域添加到/etc/ejabberd/ejabberd.cfg

    %% Hostname
    Hostname {hosts, ["example.com","98.765.43.21","localhost"]}.
    
    Run Code Online (Sandbox Code Playgroud)
  3. 确保您的用户名存在且已注册:

    ejabberdctl register username example.com password
    
    Run Code Online (Sandbox Code Playgroud)

    如果用户是管理员,则包含在ejabberd.cfg中[注意:它必须注册!]

    %% Admin user
    {acl, admin, {user, "", "localhost"}}.
    {acl, admin, {user, "admin", "example.com"}}.
    
    Run Code Online (Sandbox Code Playgroud)
  4. 检查服务器是否正在运行:

    a. sudo ejabberdctl status  
    b. http://example.com:5280/admin  
    c. http://example.com:5280/http-bind
    
    Run Code Online (Sandbox Code Playgroud)
  5. 如果有问题,请重新使用两者(我知道理论上你不需要两者.实际上,有时候使用其中一种方法是行不通的.)

    sudo /etc/init.d/ejabberd restart
    sudo ejabberdctl restart
    
    Run Code Online (Sandbox Code Playgroud)
  6. 检查日志 - /var/log/ejabberd/ejabberd.log(见这里).

  7. 安装JWChat并尝试(或者,如果你有JWChat,安装Strophe).
    以下简短教程非常宝贵,请严格遵循:http://www.ejabberd.im/jwchat-localserver