JAXL library – List of available hooks for various XMPP events

Jaxl 2.x provides an event mechanism using which developers can register callbacks for various xmpp events inside their application code. This blog post will demonstrate how to register callbacks for required xmpp events and go through a list of all available hooks. Finally, we will discuss parameters that are passed to called back methods by Jaxl core. Registering callback on XMPP events Applications can register callback for various XMPP events. Jaxl core will then callback application methods (with 2 parameters) every time associated XMPP event occurs. Shown below are some sample examples for registering callbacks. When application callback’d method is a function: function postAuth($payload, $jaxl) { } $jaxl->addPlugin(‘jaxl_post_auth’, ‘postAuth’); When application callback’d method is a public static method of a class: class MyXMPPApp { public static function postAuth($payload, $jaxl) { } } $jaxl->addPlugin(‘jaxl_post_auth’, array(‘MyXMPPApp’, ‘postAuth’)); When application callback’d method is […]

Read More

How to write External Jabber Components in PHP using Jaxl library?

Jabber Component Protocol (XEP-0114) documents how XMPP protocol can be used to communicate between servers and “external” components over the Jabber network. XMPP components “bind” to a domain, usually a sub-domain of the main XMPP service, such as service.example.org. All incoming stanzas addressed to that domain (to=’service.example.org’) or to entities on that domain (to=’user@service.example.org’) will be routed to your Jaxl (Jabber XMPP Library) based code. In this blog post, I will demonstrate a sample external jabber component bot written in PHP using Jaxl library. Refer Jaxl Installation, Usage guide and Example apps if you are new to Jaxl. Demonstrated component bot code can be obtained from Jaxl@github. Using Jabber Component Protocol Include Jaxl implementation of XEP-0114 in your application code to setup necessary environment for using Jabber component protocol. Here is how this can be done at the top of […]

Read More

XEP 0045 – Multi User Chat (MUC) available methods in Jaxl 2.0

Jaxl 2.0.3 (Jabber XMPP Library in PHP) comes with 15 XMPP extensions including XEP-0045 a.k.a. Multi-User Chat (Conference Room). In this blog post, we will go through all the methods available for XMPP applications developed using Jaxl library. Using MUC methods You need to include Jaxl implementation of XEP-0045 in your application code to start using the methods listed below. Refer Jaxl Installation, Usage guide and Example apps if you are new to Jaxl. Here is how this can be done at the top of your application code: // initialize Jaxl instance $jaxl = new JAXL(); // include MUC XEP jaxl_require(‘JAXL0045′, $jaxl); // or simply $jaxl->requires(‘JAXL0045′); Multi-User Chat available methods: Below is a detailed list of methods from multi-user room extension: $jaxl->JAXL0045(‘joinRoom’, $jid, $roomJid.”/”.$nick, $history=0, $type=’seconds’) $jaxl->JAXL0045(‘exitRoom’, $jid, $roomJid) $jaxl->JAXL0045(‘kickOccupant’, $fromJid, $nick, $roomJid, $reason=FALSE, $callback=FALSE) $jaxl->JAXL0045(‘getRoomConfig’, $jid, $roomJid, $callback=FALSE) $jaxl->JAXL0045(‘setRoomConfig’, […]

Read More

PHP Code, Setup and Demo of Jaxl boshchat application

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 git@github.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/JAXL directory 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 […]

Read More

Facebook chat connect with X-FACEBOOK-PLATFORM using Jaxl 2.0

Facebook chat provides two authentication mechanisms for authenticating chat client users. DIGEST-MD5 require chat client users to enter their username and password, while X-FACEBOOK-PLATFORM can be used to provide better user experience by using simple Facebook Platform authentication. In this blog post, I will demonstrate how to use Jaxl library for X-FACEBOOK-PLATFORM authentication. Echobot using X-FACEBOOK-PLATFORM Setup Jaxl library on your system and edit packaged sample echobot application with facebook user account details. Alternately you can also specify connecting user details inside jaxl.ini configuration file. $jaxl = new JAXL(array( ‘user’=>’fbUsername’, ‘pass’=>”, // Not required, we will use user session key instead ‘host’=>’chat.facebook.com’, ‘domain’=>’chat.facebook.com’ )); Add callback for hook jaxl_get_facebook_key: JAXLPlugin::add(‘jaxl_get_facebook_key’, array($echobot, ‘getFacebookKey’)); Complete getFacebookKey method inside echobot application, which should return back following key information: function getFacebookKey() { return array( ”, // Your application secret key ”, // Your application […]

Read More

XEP 0133 – Service Administration available methods in Jaxl 2.0

Jaxl 2.0 implements more than 10 XMPP extensions including XEP-0133 a.k.a. Service Administration. In this blog post, we will go through all the methods available for use in XMPP applications developed using Jaxl. Using Service administration methods You need to include Jaxl implementation of XEP-0133 in your application code to start using below listed available methods. Here is how this can be done at the top of your application code: // initialize jaxl instance $jaxl = new JAXL(); // include service administration $jaxl->requires(‘JAXL0133′); // or jaxl_require(‘JAXL0133′, $jaxl); Service administration available methods Below is a detailed list of methods from service administration extension: $jaxl->JAXL0133(‘addUser’, $user, $domain, $callback) $jaxl->JAXL0133(‘deleteUser’, $user, $domain, $callback) $jaxl->JAXL0133(‘disableUser’, $user, $domain, $callback) $jaxl->JAXL0133(‘reEnableUser’, $user, $domain, $callback) $jaxl->JAXL0133(‘endUserSession’, $user, $domain, $callback) $jaxl->JAXL0133(‘getUserPassword’, $user, $domain, $callback) $jaxl->JAXL0133(‘changeUserPassword’, $user, $domain, $callback) $jaxl->JAXL0133(‘getUserRoster’, $user, $domain, $callback) $jaxl->JAXL0133(‘getUserLastLoginTime’, $user, $domain, $callback) $jaxl->JAXL0133(‘getUserStatistics’, $user, […]

Read More

Jaxl 2.0 Core classes, available methods and directory structure

In this blog post we will dig deep into the core of Jaxl 2.0 – An XMPP framework written in PHP. Specifically, we will go through Jaxl core directory structure. Towards the end we will get familiar with various core classes and their available methods (e.g. $jaxl->sendMessage()), that developers can use in their XMPP applications. Core Directory Structure Now that you have the source code, lets get familiar with the Jaxl directory structure. Downloaded source code consists of following 5 directories: xmpp: Contain core stack which implements XMPP rfc’s. All files follow naming convention like xmpp.*.php core: Contains core stack which manages the library workflow. Also provides an xpath based XML parser, an event mechanism and various other utilities to the framework. All files follow naming convention like jaxl.*.php xep: Contains implemented XMPP extensions (XEP’s). All files follow naming convention […]

Read More

Writing a command line XMPP bot (echobot) using Jaxl 2.0

In this blog post, we will write a sample XMPP bot (echobot) using Jaxl 2.0. In turn we will introduce ourselves to some of the basic functionality we can do using Jaxl e.g. fetching roster list, subscribing and unsubscribing to a user presence, etc. We will also focus on how to use XMPP extensions (XEP’s) inside our echobot code. Specifically, we will make use of XEP-0085 (chat state notification), XEP-0203 (delayed delivery) and XEP-0092 (software version) in our sample echobot application. Echobot source code: This sample echobot application comes packaged with Jaxl 2.0. If you have already read Installation, Usage guide and Running example apps, you might have even run this sample application. Alternately, browse and download the sample source code from github echobot app files Coding with Jaxl 2.0: Every XMPP application developed using Jaxl 2.0, MUST have a […]

Read More

Jaxl 2.0 – Installation, Usage guide and Example apps

This blog post provides detailed instructions on how to download and setup Jaxl 2.0 for quick XMPP application development using PHP. We will also see how to run XMPP bots using Jaxl command line utility (now available by just typing jaxl on the terminal). Get the source code Jaxl 2.0 development version source code is available at github. For better experience download latest stable tarball from google code The development version of Jaxl is hosted here at Github, have fun cloning the source code with Git. If you are not familar with Git just use the download button to get a tarball. root@ubuntu:~/git# git clone git://github.com/abhinavsingh/JAXL.git Warning: the development source code is only intended for people that want to develop Jaxl or absolutely need the latest features still not available on the stable releases. Installation on *nix Systems Extract the […]

Read More