JAXL Instance

JAXL instance configure/manage other sub-packages. It provides an event based callback methodology on various underlying object. Whenever required JAXL instance will itself perform the configured defaults.

Constructor options

  1. jid

  2. pass

  3. resource

    If not passed Jaxl will use a random resource value

  4. auth_type

    DIGEST-MD5, PLAIN (default), CRAM-MD5, ANONYMOUS, X-FACEBOOK-PLATFORM

  5. host

  6. port

  7. bosh_url

  8. log_path

  9. log_level

    JAXL_ERROR, JAXL_WARNING, JAXL_NOTICE, JAXL_INFO (default), JAXL_DEBUG

  10. fb_access_token

    required when using X-FACEBOOK-PLATFORM auth mechanism

  11. fb_app_key

    required when using X-FACEBOOK-PLATFORM auth mechanism

  12. force_tls

  13. stream_context

  14. priv_dir

    Jaxl creates 4 directories names log, tmp, run and sock inside a private directory which defaults to JAXL_CWD.'/.jaxl'. If this option is passed, it will overwrite default private directory.

    Note

    Jaxl currently doesn’t check upon the permissions of passed priv_dir. Make sure Jaxl library have sufficient permissions to create above mentioned directories.

Available Event Callbacks

Following $ev are available on JAXL lifecycle for registering callbacks:

  1. on_connect

    JAXL instance has connected successfully

  2. on_connect_error

    JAXL instance failed to connect

  3. on_stream_start

    JAXL instance has successfully initiated XMPP stream with the jabber server

  4. on_stream_features

    JAXL instance has received supported stream features

  5. on_auth_success

    authentication successful

  6. on_auth_failure

    authentication failed

  7. on_presence_stanza

    JAXL instance has received a presence stanza

  8. on_{$type}_message

    JAXL instance has received a message stanza. $type can be chat, groupchat, headline, normal, error

  9. on_stanza_id_{$id}

    Useful when dealing with iq stanza. This event is fired when JAXL instance has received response to a particular xmpp stanza id

  10. on_{$name}_stanza

    Useful when dealing with custom xmpp stanza

  11. on_disconnect

    JAXL instance has disconnected from the jabber server

Available Methods

Following methods are available on initialized JAXL instance object:

  1. get_pid_file_path()

    returns path of JAXL instance pid file

  2. get_sock_file_path()

    returns path to JAXL ipc unix socket domain

  3. require_xep($xeps=array())

    autoload and initialize passed XEP’s

  4. add_cb($ev, $cb, $pri=1)

    add a callback to function $cb on event $ev, returns a reference of added callback

  5. del_cb($ref)

    delete previously registered event callback

  6. set_status($status, $show, $priority)

    send a presence status stanza

  7. send_chat_msg($to, $body, $thread=null, $subject=null)

    send a message stanza of type chat

  8. get_vcard($jid=null, $cb=null)

    fetch vcard for bare $jid, passed $cb will be called with received vcard stanza

  9. get_roster($cb=null)

    fetch roster list of connected jabber client, passed $cb will be called with received roster stanza

  10. start($opts=array())

    start configured JAXL instance, optionally accepts two options specified below:

    1. --with-debug-shell

      start JAXL instance and enter an interactive console

    2. --with-unix-sock

      start JAXL instance with support for IPC and remote debugging

  11. send($stanza)

    send an instance of JAXLXml packet over connected socket

  12. send_raw($data)

    send raw payload over connected socket

  13. get_msg_pkt($attrs, $body=null, $thread=null, $subject=null, $payload=null)

  14. get_pres_pkt($attrs, $status=null, $show=null, $priority=null, $payload=null)

  15. get_iq_pkt($attrs, $payload)