Releasing Jaxl v3.x - Faster, Modular, Fully OOPS, Fully Asynchronous

792 views
Skip to first unread message

Abhinav Singh

unread,
Jun 18, 2012, 12:30:51 PM6/18/12
to ja...@googlegroups.com

Jaxl v3.x:

https://github.com/abhinavsingh/JAXL/tree/v3.x

Jaxl v3.x is a successor of v2.x (and is NOT backward compatible), carrying a lot of code from v2.x while throwing away the redundant part. Several components have been re-written keeping in my mind feedback from the developer community over the last 4 years.

Jaxl v3.x is an object oriented, non-blocking, event based modular XMPP client/component library.

Structure:

Library src folder contains following sub-folders:

  • /examples a bunch of working examples
  • /xmpp contains generic xmpp rfc implementation
  • /xep contains various xmpp xep implementation
  • /core contains generic networking and event components
  • /tests test suite
  • /jaxl.php main file

With v3.x, every thing has been mapped into an object:

  • JAXLEvent event registry and emitter class
  • JAXLSocket socket level operations
  • JAXLXmlStream streaming XML parser
  • JAXLXml internal XML object implementation
  • XMPPStream base xmpp rfc implementation
  • XMPPStanza wrapper over JAXLXml for easy access patterns
  • XMPPIq xmpp iq stanza object (extends XMPPStanza)
  • XMPPMsg xmpp msg stanza object (extends XMPPStanza)
  • XMPPPres xmpp pres stanza object (extends XMPPStanza)
  • XMPPXep abstract xmpp extension (extended by every XEP implementation)
  • XMPPJid xmpp jid object

Getting Started:

1) include jaxl.php and initialize a new JAXL instance

$cfg = array('jid'=>'us...@domain.dtl', 'pass'=>'password');
$xmpp = new JAXL($cfg);

2) register callbacks on events

$xmpp->add_cb('on_auth_success', function() {
    global $xmpp;
    $xmpp->set_status("available!");  // set your status
    $xmpp->get_vcard();               // fetch your vcard
    $xmpp->get_roster();              // fetch your roster list
});

$xmpp->add_cb('on_chat_message', function($msg) {
    global $xmpp;
    
    // echo back
    $msg->to = $msg->from;
    $msg->from = $xmpp->full_jid->to_string();
    $xmpp->send($msg);
});

3) finally start configured JAXL instance

$xmpp->start();

Julien Lenne

unread,
Jun 18, 2012, 1:09:15 PM6/18/12
to ja...@googlegroups.com
Hi there !

Congratulations on this new major version !

But like others maybe, I have some requests/questions ;p

First, could you give us the up-to-date changelog for this version please ?

And next, could you tell us why we should use the 3.x version instead of the 2.x ?
In fact, for many months now, I'm making my website using your library, and I want to know if I should take some time to make it to 3.x, or if I should wait some time (for stabilization, or more tests).
In my case (but a response for all would be useful for the community I think), I'm using it in a bosh context.

Thanks in advance,
Julien.

Abhinav Singh

unread,
Jun 18, 2012, 5:12:47 PM6/18/12
to ja...@googlegroups.com
Thanks Julien. Jaxl v2.x is now being used by several small and big projects, enterprises to hackers.
I was expecting some questions and was planning to answer few that you already asked.

I will also take this opportunity to reflect on how and why Jaxl library came into picture.
Not many might know or heard about gtalkbots.com (it's down and probably i no longer own this domain)
This was a side project which i took up in 2007. gtalkbots.com used to host several utility bots which make
your life simpler and fun. ana...@gtalkbots.com was probably the most famous one, which even saw some of
it's users writing a playing bot to play with and earn points using Jaxl library itself.

However, idea was not to build bots, but to learn xmpp. I myself used XMPPHP to run gtalkbots bot initially,
however bots used to die after some days of activity. There were a few other reasons including lack of proper
documentation and my NIH syndrome at that point in time which led me to write my own library to fulfill every
thing i planned to do with this gtalkbots project. After few years with gtalkbots.com library I
was working upon was released as jaxl v1.x, At this point i don't even remember the initial structure of
v1.x library. Being from electronics/communication background, don't make me a decent programmer either.

Main aim as jaxl reached v2.x was to make it usable for the masses. As simple as someone can expect it
to be. This was the period while i was also further exploring XMPP and it's related extensions, as a result v2.x saw
far too many XEP implementations added into it.

v2.x biggest usage as per my knowledge was being made at http://jaxl.im released in 2010 .
Backend messaging routers and server side components were written using Jaxl v2.x, which saw as many as 15k
websites using the hosted instant messenger. As daily message traffic was increasing i soon realized, even though
i can go on to scale my server side components by running several more instances for the components across machines,
this is not a long term solution for the stuff i am working upon (or have in my mind). Bottlenecks with v2.x were
XML parsing and amount of bytes PHP can handle on opened socket.

In an effort to solve for optimization, speed and scalability while keeping the easy to use nature of v2.x, v3.x was born.
As mentioned in the README.md, v3.x carry most of the code written for v2.x, while throwing away the ugly parts,
rewritting the bad parts and bad design principles. Jaxl v3.x was an easy replacement for v2.x
inside Jaxl IM backend since i wasn't using the BOSH part of v2.x

v3.x yet do not support v2.x style BOSH
View v3.x /examples to see what BOSH here means right now.
In future i plan to add v2.x style BOSH support inside v3.x though i.e. via Web

I haven't been using v3.x since quite some time now since Erlang became the language of choice
for writting all my backend stuff. Infact towards the end Jaxl IM platform had no traces of PHP.

Now that the project is gone, I am back to some PHP for some reasons, i planned to release
v3.x into the community. It's cleaner, better, modular, much much much faster, async, oops.
I also plan to work on exhaustive documentation in coming days to support v3.x. Also v3.x will
soon have MUC, PubSub and other essential XEP's packaged for consumption. Also as 
requested, a changelog list (which you can also get from github checkin comments, my checkin
comments are quite exhaustive when required)

As of today, if you plan to write command line long running xmpp client/component bots, i will
recommend you to go for v3.x. However, if you are still very much dependent upon v2.x style BOSH,
it's still not a good time for change. I will announce when it is ready for consumption.

In long term i plan to support v3.x for all kind of bugs issues that might be faced by developers
adopting v3.x. However, even though more useful feature full, i don't plan to support v2.x any longer.
From my current mindset, v2.x has been a combination of good, bad and the ugly, which still does
it's task.

--
Abhinav

Julien Bunel

unread,
Jun 19, 2012, 4:46:53 AM6/19/12
to ja...@googlegroups.com
Hi Abhinav,

I'm watching the v3 of JAXL and I realize that there are very few of XEP implemented.

Today I
used many XEP :

XEP 0085 for chat state
XEP 0199 for ping xmpp
XEP 0206 for bosh
XEP 0054 for vcard
XEP 0045 for MUC
and XEP 0249 for direct invitation

it is simple to implement XEP from the new library ?
Can i help you to develop other XEP ?

Cordially,
Julien Bunel







2012/6/18 Abhinav Singh <mailsfo...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "jaxl" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jaxl/-/vQ3RP5O5dLUJ.

To post to this group, send email to ja...@googlegroups.com.
To unsubscribe from this group, send email to jaxl+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jaxl?hl=en.



--
Julien Bunel

Codealacarte.fr
52 Ter Rue de Billancourt
92100 Boulogne Billancourt
Tél : 06.50.87.97.40
jul...@codealacarte.fr

http://www.codealacarte.fr/

Abhinav Singh

unread,
Jun 19, 2012, 9:04:53 AM6/19/12
to ja...@googlegroups.com
Hi Julien,

Yes v3.x lacks most of the XEP's from v2.x
However, we have a structure in place and we will mostly only have to
shift the code of required XEP's and make it compatible with v3.x

Depending upon the XEP it can be 30 min to 1 hour exercise.
In near future i will be working on MUC/PubSub myself and share the code 
as i work on them.

Ofcourse i will need a lot of help from the community, if v3.x has to
completely replace v2.x. Help in terms of code contribution, better
workflow management, better event naming, ... better documentation...
all matters :)

--
Abhinav
To unsubscribe from this group, send email to jaxl+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/jaxl?hl=en.

Abhinav Singh

unread,
Jul 20, 2012, 11:40:55 AM7/20/12
to ja...@googlegroups.com

Just for an update on this thread:

Jaxl v3.x is a successor of v2.x (and is NOT backward compatible), carrying a lot of code from v2.x while throwing away the ugly parts. A lot of components have been re-written keeping in mind the feedback from the developer community over the last 4 years. Also Jaxl now shares a few philosophies from my experience with erlang and python languages.

Jaxl is an asynchronous, non-blocking I/O, event based PHP library for writing custom TCP/IP client and server implementations. From it’s previous versions, library inherits a full blown stable support for XMPP protocol stack. In v3.0, support for HTTP protocol stack was also added.

At the heart of every protocol stack sits a Core stack. It contains all the building blocks for everything that we aim to do with Jaxl library. Both XMPP and HTTP protocol stacks are written on top of the Core stack. Infact the source code of protocol implementations knows nothing about the standard (inbuilt) PHP socket and stream methods.

documentation now available at:

Pablo Lievano Torres

unread,
Jul 27, 2012, 12:48:39 PM7/27/12
to ja...@googlegroups.com
Hi everyone.

do jaxl works in windows using wamp server?

thanks

Abhinav Singh

unread,
Jul 30, 2012, 5:37:14 PM7/30/12
to ja...@googlegroups.com
Hi Pablo,

I haven't really tested Jaxl v3.x on windows yet. But i see no reason for it to fail, since it is written on top of Jaxl v2.x core code (which worked well on windows). 

I see you have been done X-FACEBOOK-PLATFORM auth in another thread here. Can you confirm if Jaxl v3.x worked for you on windows. (I will need to find a windows based system/virtualbox to test this myself out)

--
Abhinav

Pablo Lievano Torres

unread,
Jul 31, 2012, 9:53:12 AM7/31/12
to ja...@googlegroups.com
hello  Abhinav .

I be able to connect JAXL with facebook, i used CentOS.

I try to make a script using JAXL to work in WAMP Server in Windows.

:D
Message has been deleted

Murali Krishna P

unread,
Jul 31, 2012, 10:07:26 AM7/31/12
to ja...@googlegroups.com
 
I am very new to this XMPP. please do let me know how to start up. how to learn the things.


i wanted to implement facebook chat api in my webserver. People should come to my site and chat with their online friends.  


Saw the posts. i was confused totally. Please help me out.!! 

Abhinav Singh

unread,
Aug 5, 2012, 4:01:24 AM8/5/12
to ja...@googlegroups.com
Hi Pablo,

Just to confirm.
Today i went to a Windows box and tried Jaxl v3.x
It works as expected. Do let me know of any issues you face on windows.

--
Abhinav

Abhinav Singh

unread,
Aug 26, 2012, 11:16:55 PM8/26/12
to ja...@googlegroups.com
Thanks Alakananda,

I just realized there isn't any tagged released of v3.x as of yet as indicated on the documentation download & install.
I will fix that part of the documentation, also soon we will have a tagged release to download.

Meanwhile kindly use the following links for downloading Jaxl v3.x:

Let me know if you face any difficulty obtaining the library itself.

--
Abhinav

On Monday, August 27, 2012 8:41:28 AM UTC+5:30, Alakananda Sengupta wrote:
Hi,

could you please post the download link here for 3.x

thanks,
Alakananda

Alakananda Sengupta

unread,
Aug 26, 2012, 11:23:27 PM8/26/12
to ja...@googlegroups.com
Hi,

thanks for the links.

However I am confused, when downloaded, it is saved as abhinavsingh-JAXL-v2.1.2-rc1-215-g3c08c30.zip.

In fact I had found this link earlier but the version name made me think it's the wrong file.

Thanks,
Alakananda

Abhinav Singh

unread,
Aug 26, 2012, 11:34:02 PM8/26/12
to ja...@googlegroups.com
Hi Alakananda,

This is really confusing for everyone including me.
I too just realized that the name of downloaded file is something like: abhinavsingh-JAXL-v2.1.2-rc1-......zip

However, as indicated by zip file name, it is NOT v2.x that is getting downloaded.
Unzipping the file gives me a folder named: abhinavsingh-JAXL-3c08c30e6
where 3c08c30e6 indicates the latest commit I made a day ago https://github.com/abhinavsingh/JAXL/commit/3c08c30e639b403244c2b01af8dbd5d0118f0d0c

Thanks again for pointing this out.
This can seriously confuse any new user of Jaxl library.

--
Abhinav

Abhinav Singh

unread,
Sep 8, 2012, 6:52:12 AM9/8/12
to ja...@googlegroups.com

http://abhinavsingh.com/blog/2012/09/working-with-jaxl-a-networking-library-in-php-part-1-an-introduction-philosophy-and-history/

In coming weeks, under this series of blog posts titled “Working with Jaxl – A Networking Library in PHP”, I will cover following major topics with sample code:

  • Explanation of each Core stack class and how to use them
  • Design of each XMPP and HTTP stack class
  • XMPP over HTTP
  • XMPP File Transfer and Multimedia Sessions
  • Understanding and Using External Jabber Components
  • Asynchronous Job/Task Queues
  • Developing Concurrent and Parallel Systems
--
Abhinav

manish lakhara

unread,
Dec 2, 2012, 1:03:03 PM12/2/12
to ja...@googlegroups.com
Hello Abhinav
 I am interested in making a CodeIgniter Library for JAXL v 3.x for a project that deals with XMPP pubsub, notifications and other features.
I just checked out the examples included with the library observed that JAXL works by creating an event loop to do stuff.
I on the other hand want my application to connect,create a notification and exit as it happens in traditional php scripts.
My question is IS it possible to do that with JAXL? If yes, how?

Abhinav Singh

unread,
Dec 3, 2012, 6:33:35 AM12/3/12
to ja...@googlegroups.com
Hi Manish,

Yes, jaxl core provides a central event loop utility called JAXLLoop, which is used by xmpp and http stack.
There are a number of ways to achieve what you want to have:
  1. use the same workflow (i.e. creation of event loop) and exit the jabber connection once job is done (i.e. once you have sent the notification). Event loop will automatically exit if it has no file descriptors registered with it (in turn your script will exit just like traditional php scripts).
  2. alternately, you can extend over xmpp_rest.php example which demonstrate how to interact with xmpp daemons running in the background via RESTful HTTP API's
  3. you can also extend over IPC (interprocess communication) functionality or even make use of JAXLPipes for interacting with your xmpp daemons running in the background.
Choose whats best for your application environment.

--
Abhinav

Abhinav Singh

unread,
Apr 7, 2013, 2:04:25 AM4/7/13
to ja...@googlegroups.com
Hi Mitch,

The project is very much alive :) Having said that, mainly due to bandwidth constraints at my end, I am currently running the project in a maintenance mode. Pushing bug fixes as they get reported. I am not actively working to add new features to the project right now. But I am quite open to contributions and merging them into the project branch. I do regularly checkout the work done over various forks.

If you have any specific feature in your mind, kindly feel free to share that with me.

--
Abhinav

On Sunday, April 7, 2013 8:02:46 AM UTC+5:30, Mitch Dodge wrote:
I've noticed that there hasn't been much activity on this project in a while.  Is this still an active project, or is it dead?

I'm currently using JAXL for chat logging and for some simple chat commands, and would love to see it expand to cover more functionality.
Reply all
Reply to author
Forward
0 new messages