Sunday, December 28, 2014

install ejabberd + Converse.js, XMPP chat client

1- install xmpp server, ejabberd follow the link below

2- enable http-bind on the xmpp server by editing file /etc/ejabberd/ejabberd.cfg to the following content
{acl, admin, {user, "admin1", "test.qq"}}.
{acl, admin, {user, "root", "debian"}}.
{hosts, ["test.qq","mail.test.qq"]}.
{loglevel, 4}.
  {5222, ejabberd_c2s, [
                        {access, c2s},
                        {shaper, c2s_shaper},
                        {max_stanza_size, 65536},
                        starttls, {certfile, "/etc/ejabberd/ejabberd.pem"}
  {5269, ejabberd_s2s_in, [
                           {shaper, s2s_shaper},
                           {max_stanza_size, 131072}
  {5280, ejabberd_http, [
{request_handlers, [
            {["xmpp-httpbind"], mod_http_bind}
m_queue, 1000}.
{s2s_use_starttls, true}.
{s2s_certfile, "/etc/ejabberd/ejabberd.pem"}.
{auth_method, internal}.
{shaper, normal, {maxrate, 1000}}.
{shaper, fast, {maxrate, 50000}}.
{acl, local, {user_regexp, ""}}.
{access, max_user_sessions, [{10, all}]}.
{access, max_user_offline_messages, [{5000, admin}, {100, all}]}.
{access, local, [{allow, local}]}.
{access, c2s, [{deny, blocked},
               {allow, all}]}.
{access, c2s_shaper, [{none, admin},
                      {normal, all}]}.
{access, s2s_shaper, [{fast, all}]}.
{access, announce, [{allow, admin}]}.
{access, configure, [{allow, admin}]}.
{access, muc_admin, [{allow, admin}]}.
{access, muc, [{allow, all}]}.
% (note that if you remove mod_register from modules list then users will not
% be able to change their password as well as register).
% This setting is default because it's more safe.
{access, register, [{deny, all}]}.
{access, pubsub_createnode, [{allow, all}]}.
{language, "en"}.
{mod_http_bind, []},
  {mod_adhoc,    []},
  {mod_announce, [{access, announce}]}, % requires mod_adhoc
  {mod_caps,     []},
  {mod_configure,[]}, % requires mod_adhoc
  {mod_admin_extra, []},
  {mod_disco,    []},
  {mod_irc,      []},
  {mod_last,     []},
  {mod_muc,      [
                  {access, muc},
                  {access_create, muc},
                  {access_persistent, muc},
                  {access_admin, muc_admin},
                  {max_users, 500}
  {mod_offline,  [{access_max_user_messages, max_user_offline_messages}]},
  {mod_privacy,  []},
  {mod_private,  []},
  {mod_proxy65,  [
                  {access, local},
                  {shaper, c2s_shaper}
  {mod_pubsub,   [ % requires mod_caps
                  {access_createnode, pubsub_createnode},
                  {pep_sendlast_offline, false},
                  {last_item_cache, false},
                  {plugins, ["flat", "hometree", "pep"]}  % pep requires mod_cap                                                                                                                s
  {mod_register, [
                  {welcome_message, {"Welcome!",
                                     "Welcome to a Jabber service powered by Deb                                                                                                                ian. "
                                     "For information about Jabber visit "
                  {access, register}
  {mod_roster,   []},
  {mod_stats,    []},
  {mod_time,     []},
  {mod_vcard,    []},
  {mod_version,  []}

3- configure apache configuration to redirect to the http-bind add the following file to file /etc/apache2/apache2.conf
ProxyPass  /
ProxyPassReverse  /

- restart apache
root@xmpp:/# service apache2 restart

4- download Converse.js and extract to apache document root
$ wget
$ unzip /var/www/html/

5- edit Converse.js setting in /var/www/html/converse.js-master/index.html
            allow_otr: true,
            auto_list_rooms: false,
            auto_subscribe: false,
            bosh_service_url: 'http://test.qq', // Please use this connection manager only for testing purposes
            hide_muc_server: false,
            i18n: locales['en'], // Refer to ./locale/locales.js to see which locales are supported
            keepalive: true,
            play_sounds: true,
            roster_groups: true,
            show_controlbox_by_default: true,
            xhr_user_search: false

6- access and login "http://localhost/converse.js-master/"

--- Note ---
xmpp server and converse.js, don't have to be on the same machine


  1. I too have configured my own XMPP Server with BOSH URL...But on successful login, I dont see teh "ROOMS" tab. Is there some EJabberd configuration missing that enables Chat rooms, or am i mising on something ?

  2. Problem solved...allow_muc was set to false. Thanks

  3. This comment has been removed by the author.

  4. How to set auto login (SSO) from wordpress?