Configuring ejabberd with jwchat

Jwchat is a full featured web based jabber client. Yesterday I tried to give a try for jwchat. Its simply awesome. These are the procedure for configuring ejabberd to make jwchat work. I am using kubuntu karmic kola as a test machine.

1)Download jwchat tar ball from here.

2) Install ejabberd( I used aptitude)

3)Create a directory ‘www’ in /var/lib/ejabberd/

4) Untar the jwchat to the /var/lib/ejabberd/www/

Give permission for the www directory as ejabberd

Now its time to configure the ejabberd and jwchat. Lets configure /etc/ejabberd/ejabberd.cfg first.

1) Uncomment the “override_acls.”

2) Since I am testing it in my machine I wouldn’t like to change Hostname part. I would like to keep it as localhost.

3) To my knowledge jwchat works with http-poll and http-bind. Hence we need to configure the port to which jwchat should listen to http-bind/http-poll.

{listen,

{5280, ejabberd_http, [
{request_handlers, [
{[“web”],mod_http_fileserver}
]},
http_poll,
http_bind,
web_admin

]}

4) In the modules section of the ejabberd.cfg  add the following lines:

{mod_http_bind, []},

{mod_http_fileserver, [
{docroot,”/var/lib/ejabberd/www”},
{accesslog,”/var/log/ejabberd/webaccess.log”}
]},

I had added these lines at the start of the modules section, hence you may notice the trailing comma for the mod_http_fileserver. If you are adding it to the end of the modules section remove the trailing comma.

The ejabberd acts as a small webserver too. Hence you don’t have to install apache.

I forgot to tell you the version of ejabberd I am using. Its 2.0.1. After surfing a little in the internet I had found lot of users raised issues against ejabberd. And develepors are fixing it. Its good for a healthy project. Right?

5) Please do restart ejabberd: /etc/init.d/ejabberd restart

6) Test whether the port is open by: ‘telnet localhost 5280’ or by ‘netstat -anp | grep 5280’. If its open everything is fine.

5) Lets configure to jwchat’s config.js(/var/lib/ejabberd/www/jwchat/)

var SITENAME = “localhost”;

As I mentioned I am using localhost, I would like to go ahead with it. If you are trying to use any different domain. Please mention it here.  For eg:

var SITENAME = “jabber.example.com”

The BACKENDS section takes care of http-poll,http-bind and others.

Hence I have,

var BACKENDS =
[
{
name:”Native Binding”,
description:”Ejabberd’s native HTTP Binding backend”,
httpbase:”/http-bind/”,
type:”binding”,
servers_allowed:[SITENAME]
},
{
name:”Native Polling”,
description:”Ejabberd’s native HTTP Polling backend”,
httpbase:”/http-poll/”,
type:”polling”,
servers_allowed:[SITENAME]
}

];

You had configured the ejabberd + jwchat. Now open :

http://localhost:5280/web/jwchat/index.html

in the browser. You should be able to see the login window. Bingo you are done.

Since I liked to explore more. I had a look at the ejabberdctl command. So thought of creating users using command line.

ejabberdctl register foo localhost 123

ejabberdctl register bar localhost 123

Read man page of ejabberdctl to understand the above command and args.

Now try to login using foo and bar in two new windows of the browser. And try to add them as contacts. Enjoy chatting 🙂

Leave a comment

Your comment