[Server-devel] Chat on ejabberd from any browser with MUCkl

Anna aschoolf at gmail.com
Sun Oct 13 22:49:38 EDT 2013


MUCkl is a web based front end to ejabberd.  Why might you need something
like that?  Well, it's one thing to show off your XSCE/DXS and talk about
collaboration.  It's another thing if people can chat via your ejabberd
instance from any device with a browser, including phones.  A chat server
isn't any fun without people on there chatting.  Lowering the barrier to
entry makes it easier for folks to give it a whirl and also maybe create
some buzz.

The dude who coded MUCkl hasn't worked on it for a very long time, but
luckily it still works and he's still hosting it at
http://stefan-strigler.de/muckl/  He put it up on github at
https://github.com/sstrigler/MUCkl, but it looks like it's an older version
from the tarball on his site.

Of course the XSCE and DXS ejabberd installations support "regular" XMPP
clients like Pidgin, Gajim, Psi, Adium, Jabiru (Android), et. al.  But if
some looky-loos just want to jump on ejabberd via a browser rather than
futz around with configuring a client and registering a user, MUCkl is a
relatively easy option.

Lemme just say it's a lot simpler to get MUCkl to work on the XSCE/DXS than
it was on the XS 0.6.  I recall having to enable and configure a bunch of
Apache modules on the XS 0.6 (mod_proxy, mod_rewrite, etc.), but all those
are already set up by default on the XSCE/DXS.

Note - It's very possible you might screw up ejabberd doing this, so be
very careful.  And read all the instructions below before you haul off and
do anything.  And for goodness sakes, do not do this on a mission critical
production machine, at least not for your first go round.  Enough warning?
 Let's get to it.

Enable http_bind in /etc/ejabberd/ejabberd-xs.cfg.in:

Look for where port 5280 is defined and add http_bind as shown below.
 Warning: if you misplace a comma, or even sneeze while editing this config
file, ejabberd won't start back up.

  , {5280, ejabberd_http, [
                         inet6,
   http_poll,
 http_bind,
   web_admin
  ]}

Still in /etc/ejabberd/ejabberd-xs.cfg.in, and near the bottom of the file,
look for the MODULES section.  Stick mod_http_bind in there as shown below.
 Again, be careful with the brackets and commas, the ejabberd config file
is touchy.

  {mod_vcard,    []},
  {mod_http_bind, []},
  {mod_version,  []}
 ]}.

Do xs-domain-config to write the changes to ejabberd-xs.cfg.

Throw muckl.conf into /etc/httpd/conf.d.  Here's what I'm using, per cat
/etc/httpd/conf.d/muckl.conf:

AddDefaultCharset UTF-8
Options +Multiviews
ProxyRequests Off
RewriteEngine On
RewriteRule ^/http-bind/ http://localhost:5280/http-bind/ [P]

Restart ejabberd and apache (note - ejabberd might take a minute or so to
fully restart):
ejabberdctl restart
systemctl restart httpd.service

At this point, go to http://schoolserver.local:5280/http-bind/ and you
should see this:

ejabberd mod_http_bind
An implementation of XMPP over BOSH (XEP-0206)
This web page is only informative. To use HTTP-Bind you need a Jabber/XMPP
client that supports it.

If you get a 404 on http://schoolserver.local:5280/http-bind/, see if a
reboot helps.  MUCkl will not work if http-bind doesn't.

Create the muckl user:
-bash-4.2# ejabberdctl register muckl schoolserver.local 12muckl
User muckl at schoolserver.local successfully registered

You can also create the muckl user via Pidgin.  During XSCE/DXS testing,
sometimes it's helpful to be logged into ejabberd via Pidgin (or any "real"
XMPP client) so you can see (and hear) when ejabberd clients come online.

http://wiki.laptop.org/go/XS_Community_Edition/0.4/Testing#Using_Pidgin_to_Monitor_Ejabberd

Create a persistent chatroom:
I usually use Pidgin for this.  Once I'm logged in, it's a few steps.
1.  Go to Buddies -> Join a Chat...
2.  In the Room field, enter a chatroom name.  I usually just use "chat"
for the room name.  Click "Join."
3.  A "Create New Room" box should pop up.  Click "Configure Room."
4.  Click the tickbox next to "Make Room Persistent" and that's it.  Click
"OK" and you'll join that room.
5.  You don't have to stay in that room, exit out of it if you like.  You
can always rejoin later.

Download the MUCkl tarball into the webserver root.

cd /var/www/html
wget http://stefan-strigler.de/download/muckl-0.4.4.tar.gz

Unpack it and rename the dir muckl or chat or whatever.  Remember this is
what users will navigate to in their browsers, so keep it simple.  You want
to be able to tell users an easy, memorable URL, like
http://schoolserver/chat.

Inside the muckl or chat dir, whatever you named it, create .htaccess:

AddDefaultCharset UTF-8
 Options +MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule http-bind/ http://localhost:5280/http-bind/ [P]
</IfModule>

Edit config.js.  I hope diff'ing the config.js I'm using compared to what
it shipped with is instructive enough.

diff config.js config.js.bak
31c31
< var BACKENDTYPE = 'binding';
---
> var BACKENDTYPE = 'polling';
44c44
< var HTTPBASE = "/http-bind/";
---
> var HTTPBASE = "/http-poll/";
51c51
< var XMPPDOMAIN = "schoolserver.local"; // domain name of jabber service
to be used
---
> var XMPPDOMAIN = "localhost"; // domain name of jabber service to be used
57c57
< var MUCKLPASS = "12muckl"; // password
---
> var MUCKLPASS = "muckl"; // password
69,71c69,71
<                 name:'chat',
<                 description:'Welcome to the XSCE chat server',
<                 server:'conference.schoolserver.local'//,
---
>                 name:'test',
>                 description:'some room for testing',
>                 server:'conference.localhost'//,

If it's being hosted on an XO, I would recommend this additional edit to
config.js, from "false" to "true"  Otherwise it can take a long time to
feed the chat scrollback to the web clients.

/* CONFERENCENOHIST
 * whether to not show room history upon joining
 */
var CONFERENCENOHIST = true;

This isn't necessary, but it can speed things up a little bit, so I prefer
to get rid of the background image by commenting this line out in muckl.css:
# background: url(images/mucklbg.jpg) repeat;

After all this, any user from any browser on most every platform or device,
if they're able to hit the XSCE/DXS's Apache server whatsoever, should be
able to go to http://schoolserver/chat, or even just the LAN IP, my local
example is http://192.168.1.7/chat.  Then enter a nick, hit enter, and
gossip on the ejabberd server.

Anna Schoolfield
Birmingham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/server-devel/attachments/20131013/2df5e209/attachment-0001.html>


More information about the Server-devel mailing list