ejabberd includes a HTTP-Bind service and a simple HTTP file server since ejabberd 2.0.0. With all this, ejabberd can serve web clients like JWChat and MUCkl, and you don't need to setup additional programs like a web server.
This tutorial explains how to get JWChat to work with ejabberd 2.0.0 or newer. It is assumed you already have ejabberd installed and working correctly.
Alternative: Install JWChat using Apache
Setup ejabberd
- Create a directory that ejabberd will serve. For example:
mkdir /var/lib/ejabberd/www
- Modify ejabberd.cfg accordingly:
{listen, [ ... {5280, ejabberd_http, [ {request_handlers, [ {["web"], mod_http_fileserver} ]}, http_bind, http_poll, web_admin ]} ]}. {modules, [ ... {mod_http_bind, []}, {mod_http_fileserver, [ {docroot, "/var/lib/ejabberd/www"}, {accesslog, "/var/log/ejabberd/webaccess.log"} ]} ]}.
Note that in Microsoft Windows, the paths must be with this format: "C:\\ejabberd-2.0.0\\www" - Restart ejabberd
JWChat
- Download JWChat 1.0 from JWChat website to the directory that ejabberd is serving and uncompress:
cd /var/lib/ejabberd/www tar -xzvf jwchat-1.0.tar.gz mv jwchat-1.0 jwchat cd jwchat
- Since only a translation can be used, decide which language you prefer and rename files accordingly. For example, to put English translation, rename all the ".en" files:
for a in $(ls *.en); do b=${a%.en}; cp $a $b; done
The other files are useless, so you can delete them:rm *.html.* *.js.*
- Configure JWChat.
Modify config.js accordingly. The most important options are SITENAME and BACKENDS:
/* If your Jabber server is jabber.example.org, set this: */ var SITENAME = "jabber.example.org"; /* If HTTP-Bind works correctly, you may want do remove HTTP-Poll here */ 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] } ]; ...
- Now open your browser and point to
http://jabber.example.org:5280/web/jwchat/index.html
It should show JWChat login page and the two backends. You should be able to login and create accounts using both of them.
Notes
- If you install ejabberd from SVN, you also need to download mod_http_bind and mod_http_fileserver from ejabberd-modules SVN.
- HTTP-Poll and HTTP-Bind are two alternative connection methods. Since HTTP-Poll is not as efficient as the other, you may want to disable it in JWChat's BACKENDS.
- mod_http_fileserver is a simple file server. When the user tries to browse a directory, the module just shows 'eisdir'.
Links
- Article at Linux.com: Bringing chat to the browser with JWChat
pls can you help me i'm
pls can you help me i'm trying to implement http-binding with jwchat and ejabber but i couldn't some help?
JWChat installation in Windows
For those who may not be familiar with scriptin in Windows, the command to rename JWChat's English files would be thus:
for %a in (*.en) do ren "%a" "%~na"
This method works both with IE and Firefox now.
I used the latest Jwchat by cvs and the latest jsjac by svn and the instruction here to set up ejabberd 2.0.3 in Freebsd 7.2 prerelease. It works both with firefox and IE. The polling works only with IE. Someone said IE breaks with httpbinding. It is not true for me.
The good news is that, now I get firefox3 on freebsd to chat. with polling, it never happened.
This is a better way to set up ejabberd. We do not won't fool around with Apache and Tomcat any more.
When you want to try this, please do not forget read the README.CVS file.
By the way, you have to install a lot perl files
You can do it this way:
perl -MCPAN -e shell
....
cpan> install HTML::Template
cpan> install Locale::Maketext
cpan> install Locale::Maketext::Lexicon
...
when you make install, what ever is missing, you install it.
The make install is using bash. They assume it is in /bin/
If you are using csh,
you have to whereis bash
My bash is in /usr/local/bin/
So you have to change the cplibs.sh file.
If you do not have bash, you have to make one before make install.
Thank-you
I finally got the ejabberd + jwchat working.
After I just wrote a lengthy piece asking for help (which was this that I will now turn to this thank-you as it's not necessary any more).
Should have just followed the instructions to the letter.
Need Help installing JWChat
I am not able to make it work. Its continuously giving the error:
Received an HTTP request with Host <<"10.18.246.229">>, but couldn't find the related ejabberd virtual host.
Can you help me understand what i am doing wrong?
Please refer the below link for detailed description:
https://github.com/processone/ejabberd/issues/1679
Thanks!
Document Root Format
Hello, I've installed ejabberd and am trying to configure JWChat with HTTP-Binding, on a Windows machine.
On startup, the logs are spitting out one error:
=ERROR REPORT==== 2008-07-14 17:54:53 ===
E(<0.36.0>:gen_mod:66) : {unaccessible_document_root,mod_http_fileserver}
Here is the corresponding config file notes:
{mod_http_fileserver, [
{docroot, "F:\\Program Files\\ejabberd-2.0.1\\www"}
{accesslog, "F:\\Program Files\\ejabberd-2.0.1\\webaccess.log"}
]}
Is there something I'm missing with the Windows formatting for ejabberd? Any help is appreciated.
Full installation example
I first installed ejabberd-2.0.1_4-windows-installer.exe then followed the instructions in this comment to get a working mod_http_fileserver.beam
https://support.process-one.net/browse/EJAB-640?focusedCommentId=21403#a...
Then I configured in ejabberd.cfg
When I request the filehttp://localhost:5280/web/ejabberd.log in the web browser I get it correctly.
Nothing is logged in ejabberd.log or sasl.log. I only get that message in webaccess.log:
blank page
Hi,
I followed this tutorial but I'm getting a blank page when I point tohttp://jabber.example.org:5280/web/jwchat/index.html
Ejabberd is running and I can access admin page.
I didn't change anything in my httpd.conf, I only did what are in this tutorial page.
I don't know why is showing a blank page and firebug is empty too...
Any help?
same problem
Same story here.. I went ahead and tried to make a blank page in my web directory and I can see the requests in the logs -- they just aren't being served.
if I look at my /var/lib/ejabberd/ejabberd.log I can see this:
I(<0.1728.0>:ejabberd_http:178): (#Port<0.1382>) http query: 'GET' /web/jwchat/index.html
I don't have an accesslog in /var/log/ejabberd/webaccess.log to look at as mentioned in the config file.
My perms look like:
/var/lib/ejabberd
drwxr-xr-x 3 ejabberd ejabberd 4096 2008-07-29 11:01 www
/varlib/ejabberd/www
-rwxr-xr-x 1 ejabberd ejabberd 5 2008-07-29 10:08 index.html
drwxr-sr-x 4 ejabberd ejabberd 36864 2008-07-29 10:49 jwchat
I also had started up a simple webserver on port 5280 and that was able to pull pages remotely so it's not an issue of ports.
so I guess my problem is something to do with the http_fileserver and/or the config.
My config files look thus:
{mod_http_fileserver, [
{docroot, "/var/lib/ejabberd/www/"},
{accesslog, "/var/log/ejabberd/webaccess.log"}
]},
{mod_offline, []},
and..
% HTTP service (You may choose options HTTP-polling and Web-administering)
% When commenting out, be careful with commas
{5280, ejabberd_http, [
{request_handlers, [
{["web"], mod_http_fileserver}
]},
http_bind,
http_poll,
web_admin]}
]}.
telnet 127.0.0.1 5280
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
GET /web/jwchat/index.html HTTP/1.0
HTTP/1.0 404 Not Found
Connection: close
Content-Type: text/html; charset=utf-8
Content-Length: 330
<?xml version='1.0'?>
Not found
Connection closed by foreign host.
am I missing something here?
Jabber on remote server
I have Jabber on a different server from where jwchat is installed. I am in the process of trying to figure out how to integrate jwchat inside our portal. So, I have jwchat installed where are portal resides. Does anyone know if this is going to be a problem? Is there any additional steps that I will need to take to point to my remote jabber server?
Thanks
Session not opening for browser on remote machine
I have installed ejabberd and jwchat as described above, modified appropriately for windows. Ejabberd seems to be running fine, and i can login using jwchat from a browser running locally. However when i try to login using jwchat from a browser on a different machine, then a session is not opened. I get the login page, and the chat pop-up, and looking in the logs i can see that my username, password is authenticated. But for some reason no session is actually opened.
I see this in the logs:
=INFO REPORT==== 2008-03-18 10:14:22 ===
I(<0.368.0>:ejabberd_c2s:676) : ({socket_state,ejabberd_http_bind,{http_bind,<0.366.0>},<0.367.0>}) Accepted authentication for testuser
but not this:
=INFO REPORT==== 2008-03-18 10:13:38 ===
I(<0.362.0>:ejabberd_c2s:787) : ({socket_state,ejabberd_http_bind,{http_bind,<0.360.0>},<0.361.0>}) Opened session for testuser@jabber.blot.net/jwchat
which i get whan i successfully login from local browser.
Any ideas?
Thanks D.
Service unavailable
I did the same way as shown above in the tutorial. But when I tried to login/register it showed service unavailable. Please reply me what must be the problem.
Pratik
I got the same problem as you.
The light bulb won't turn on. Cannot chat.
Have you fix it?
I cannot find any thing in the log.
doc root in windows
Hi,
how do we give the doc root in windows ?If i give D:\etc...it is throwing error..
viji m
Try C:\\etc
how do we give the doc root in windows? If i give D:\etc...it is throwing error.
Right, this example config in the beta1 installer was not correct. Try with double lines, like this: "C:\\ejabberd-2.0.0\\www"
Thanks for this new
Thanks for this new tutorial!
I wonder though how to make the URL to access the JWChat installation a little more readable. Using Apache to serve JWChat made this as easy as defining a
<Location /jwchat>
...
</Location>
which made the JWChat installation available athttp://jabber.example.org/jwchat . What would be the best way to achieve this using the new method presented in this tutorial? Apache's mod_rewrite? Or is there an easier and more elegant way?
TIA.
Possibilities for simplified URI in ejabberd 2.0.0
The tutorial explains how to get:
http://jabber.example.org:5280/web/jwchat/index.html
In order to get this URI:
http://jabber.example.org/jwchat
three things must be changed:
Since only steps 1 and 2 are possible with ejabberd 2.0.0, the best results you can get right now using only ejabberd 2.0.0 are:
http://jabber.example.org/jwchat/index.html
https://jabber.example.org/jwchat/index.html
or
Maybe there are other solutions using Apache or other tools.
I'm actually looking for
I'm actually looking for same solution using Apache, since I require server side script processing using the web server like apache and also would like to enable http-bind service of ejabberd 2.0. Trying the same setting proxypass / mod_rewrite but nothing helped me to achieve the solution. Apache return upstream error. To know more about my confirguration http://www.ejabberd.im/node/1560#comment-51601
Couldn't you just setup a
Couldn't you just setup a redirect with your apache server?
ie:
this way it's an easy URL for your users, but still redirects to the special port..
Would it work though?
Posting from web client -> ejabberd works (in my solution with rewrite rules) but the response ejabberd -> web client doesn't work at all, I get nothing back.
I think you have to set up a proxy for it to work. Does anyone know how to do this on windows/IIS ?
[edit]
My wrong.. I had this problem with IIS but only because I set up the rule as forwarding and not as proxying. It should work swell.