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¶
jid
pass
resourceIf not passed Jaxl will use a random resource value
auth_typeDIGEST-MD5, PLAIN (default), CRAM-MD5, ANONYMOUS
host
port
bosh_url
log_path
log_level
ERROR,WARNING,NOTICE,INFO(default),DEBUG
force_tls
stream_context
priv_dirJaxl creates 4 directories names
log,tmp,runandsockinside a private directory which defaults togetcwd().'/.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:
on_connect
JAXLinstance has connected successfully
on_connect_error
JAXLinstance failed to connect
on_stream_start
JAXLinstance has successfully initiated XMPP stream with the jabber server
on_stream_features
JAXLinstance has received supported stream features
on_auth_successauthentication successful
on_auth_failureauthentication failed
on_presence_stanza
JAXLinstance has received a presence stanza
on_{$type}_message
JAXLinstance has received a message stanza.$typecan bechat,groupchat,headline,normal,error
on_stanza_id_{$id}Useful when dealing with iq stanza. This event is fired when
JAXLinstance has received response to a particular xmpp stanza id
on_{$name}_stanzaUseful when dealing with custom xmpp stanza
on_disconnect
JAXLinstance has disconnected from the jabber server
Available Methods¶
Following methods are available on initialized JAXL instance object:
get_pid_file_path()returns path of
JAXLinstance pid file
get_sock_file_path()returns path to
JAXLipc unix socket domain
require_xep($xeps = array())autoload and initialize passed XEP’s
add_cb($ev, $cb, $priority = 1)add a callback to function
$cbon event$ev, returns a reference of added callback
del_cb($ref)delete previously registered event callback
set_status($status, $show, $priority)send a presence status stanza
send_chat_msg($to, $body, $thread = null, $subject = null)send a message stanza of type chat
get_vcard($jid = null, $cb = null)fetch vcard for bare
$jid, passed$cbwill be called with received vcard stanza
get_roster($cb = null)fetch roster list of connected jabber client, passed
$cbwill be called with received roster stanza
start($opts = array())start configured
JAXLinstance, optionally accepts two options specified below:
--with-debug-shellstart
JAXLinstance and enter an interactive console
--with-unix-sockstart
JAXLinstance with support for IPC and remote debugging
send($stanza)send an instance of JAXLXml packet over connected socket
send_raw($data)send raw payload over connected socket
get_msg_pkt($attrs, $body = null, $thread = null, $subject = null, $payload = null)
get_pres_pkt($attrs, $status = null, $show = null, $priority = null, $payload = null)
get_iq_pkt($attrs, $payload)