JWChat with ejabberd using http_bind method for BOSH and lighttpd's mod_proxy
If you don't use ejabberd, you will need to set up your jabber server (and maybe an external service) for http_bind (BOSH)
Ejabberd setup
You need to enable http_bind (BOSH), this is pretty simple, except that most howtos won't tell you to enable the module, just the listener, so here is how it is done, this howto uses port 5280 for this, but it could be any.
in ejabberd.cfg
in the {listen, part
{5280, ejabberd_http, [
http_bind,
web_admin
]},
the http_bind part is important.
Then in the {modules, part, add
{mod_http_bind,[]},
lighttpd setup
ligttpd.conf:
in the server.modules = ( you will need to enable
"mod_proxy",
then i added a host with the following directives:
$HTTP["host"] == "your.webjab.tld" {
server.document-root = "/path/to/jwchat/root"
proxy.server = (
"http-bind/" =>
( (
"host" => "127.0.0.1",
"port" => 5280
) ),
)
}
JWChat setup
- You will need to extract the jwchat sources, then copy all .html.html files to .html files like so, in the jwchat root directory (someone please tell jwchat devs to stop this! ;):
#if you want localized versions, substitute .html.html to .html.yourlang, where yourlang is, well, your localized language's code ;)
$ for file in $(find . -name '*.html.html'); do
cp $file $(echo $file |sed 's,.html$,,g')
done
and .js.js files:
#if you want localized versions, substitute .js.js to .js.yourlang, where yourlang is, well, your localized language's code ;)
$ for file in $(find . -name '*.js.js'); do
cp $file $(echo $file |sed 's,.js$,,g')
done
JWChat configuration
config.js:
var SITENAME = "your_jabber_host.tld";
//we removed all non-relevant backends:
var BACKENDS =
[
{
name:"Native Binding",
description:"Ejabberd's native HTTP Binding backend",
httpbase:"/http-bind/",
type:"binding",
servers_allowed:[SITENAME]
},
];
- Then you can remove all the extraneous files:
rm *.html.* *.js.*
That's all folks, if you have any ideas on how i can make this howto better, contact me