Jaxl 2.0 bosh support allow web developers to write real time web applications within minutes, without having any pre-requisite knowledge about the XMPP protocol itself. In this blog post, I will walk you through setup and demo of an XMPP based web chat application using Jaxl library.
Get the code
Follow the following steps to download and install this sample web application on your systems:
- Clone the development branch of Jaxl library
root@ubuntu:~/git# git clone email@example.com:abhinavsingh/JAXL.git root@ubuntu:~/git# cd JAXL/ root@ubuntu:~/git/JAXL#
If you are not familiar with git, simply visit JAXL@github, click Download Source and extract under
~/git/JAXLdirectory on your system
- Once inside Jaxl source directory, build the latest development package
root@ubuntu:~/git/JAXL# ./build.sh building...
- Install Jaxl library (view installation detail and options)
root@ubuntu:~/git/JAXL# ./build.sh install uninstalling old package... installing...
Setup web chat application
Jaxl library is default installed under
/usr/share/php/jaxl folder. Application code for our web chat application can be found under
Follow these steps to setup web chat application on your system:
- I assume you have
http://localhost/configured on your local web server and it runs out of
/var/wwwfolder. Create following symlinks:
root@ubuntu:~/git/JAXL# cd /var/www root@ubuntu:/var/www# ln -s /usr/share/php/jaxl/app/boshchat/boshchat.php index.php root@ubuntu:/var/www# ln -s /usr/share/php/jaxl/app/boshchat/jaxl.ini jaxl.ini root@ubuntu:/var/www# ln -s /usr/share/php/jaxl/env/jaxl.js jaxl.js root@ubuntu:/var/www# ln -s /usr/bin/jaxl jaxl.php
Edit/Remove #!/usr/bin/env php inside
jaxl.phpif it causes any problem on your system.
- Open and edit jaxl.ini
- I assume you have access to XMPP over Bosh enabled jabber server. Ejabberd users can verify this by hitting
http://localhost:5280/http-bindin the browser
- Open and edit index.php
All messages sent using this web chat application will be routed to
Ready for the demo
To run this example web chat application, visit
http://localhost in your browser window. Enter a username/password already registered on your jabber server and press connect.
BOSHCHAT_ADMIN_JID using a desktop client, so that you can receive messages sent from the browser on your desktop client.
Below is a screenshot when I logged in as “abhinavsingh” from browser and
BOSHCHAT_ADMIN_JID was set to “firstname.lastname@example.org”: