Announcing Jaxl v3.x – asynchronous, non-blocking I/O, event based PHP client/server library

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 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.

Source code on GitHub

Examples

Documentation

Group and Mailing List

Create a bug/issue

Read why v3.x was written and what traffic it has served in the past.

  • Duane Larson

    Abhinav,

    I see that JAXL 3 doesn’t support XEP-0108 yet. I was wondering if you could help me with something.

    I’m currently trying to use JAXL 2.X and I was wondering if you could explain how to use XEP-0108 to publish user activity.

    Currently I’m doing

    $item=array(
    ‘name’=>’talking’,
    ‘type’=>’general’
    );
    $jaxl->JAXL0108(‘publishActivity’, $from, $item);

    but I don’t think I am doing the $item variable correctly because when I execute this the update isn’t sent.

  • Duane Larson

    Thanks for the reply. After looking at the code more I see how to create my own XML scheme’s and then send with sendXML() function. Very simple. Thanks for the great tool!!!

    • Great. You should particularly check this part of the documentation: http://jaxl.readthedocs.org/en/latest/users/xml_objects.html . v3.x has changed greatly compared to v2.x as far as XML generation and handling is concerned. I believe most of the XEP’s will be a fun job to implement with v3.x (shouldn’t take more than a few hours to implement a single XEP from scratch).

      Mostly you will need to generate XML packet, put that function inside your XEP and call from your application code like $xmpp->xeps['xxxx']->method($params, ....) where $xmpp is an instance of JAXL.

  • Linus Juhlin

    Hey, I’m having some issues with Jaxl. Don’t know if it’s due to my lack of knowledge or something else. But anyways.

    Used one of your example code and tried to connect to pvp.net.

    require_once ‘jaxl.php’;
    $client = new JAXL(array(
    // (required) credentials
    ‘jid’ => ‘[email protected]’,
    ‘pass’ => ‘AIR_PASSWORD’,

    // (optional) srv lookup is done if not provided
    ‘host’ => ‘chat.eu.lol.riotgames.com’,

    // (optional) result from srv lookup used by default
    ‘port’ => 5223,

    // (optional) defaults to false
    //’force_tls’ => true,

    // (optional)
    //’resource’ => ‘resource’,

    // (optional) defaults to PLAIN if supported, else other methods will be automatically tried
    ‘auth_type’ => @$argv[3] ? $argv[3] : ‘PLAIN’,

    ‘log_level’ => JAXL_INFO
    ));

    • Hi Linus,

      I see you are trying to connect to port 5223 which is unofficial port for XMPP client connections over SSL. Can you try again with force_tls option enabled?

  • Amesh

    Hi Abhinav,

    how to set the system daemon for background script running when user login

  • Eniyan

    Hi Abhinav,

    I have installed openfire on my ubuntu sucussfully and trying to connect from Jaxl v3.x for last two days. If i run any scripts found in example folder, the screen just goes blank and I dont know what i doing wrong here.

    Can you please guide me to connect with openfire server from Jaxl v3.x.

    • Hi Eniyan,

      Can you post your query on jaxl google groups
      I myself don’t play much with openfire, though Jaxl v3.x has been tested against openfire too before release.
      Also there is no reason as to why Jaxl v3.x behavior might change for different XMPP servers.
      Kindly post your query on groups along with some log data to help us out.
      You can switch debug log by setting 'log_level'=>JAXL_DEBUG inside jaxl constructor.

  • Hi , i want to write a chat application , through which i can connect to gtalk and send and receive message through it .
    I am pretty much novice right now on how to do it .
    Can you please help me out on how can i proceed on this . Can your library jaxl help me on this .

    • Hi Ankit, From today I will close comments on this blog post. You and other readers can post questions/queries on jaxl google group. Infact, you can read various existing threads in the group which will help you in getting started with what you need to build/develop.