Cisco AJAX XMPP Library Events


Web 2.0 library for XMPP-based Instant Messaging, Availability and Roster Management


Event Categories

Core Events

jabberwerx.ChatController Events

Name Data Details Description
chatSessionOpened
{
    // the created session
    chatSession: jabberwerx.ChatSession,
    // <true> if created via openSession
    userCreated: Boolean
}
Triggered when a chat session is opened. The userCreated flag is <true> if this session is created by the user via openSession()
chatSessionClosed jabberwerx.ChatSession Triggered when a chat session is closed.

jabberwerx.ChatSession Events

Name Data Details Description
beforeChatSent jabberwerx.Message Triggered before the chat message is sent. This event allows callbacks to modify the stanza before delivery.
chatSent jabberwerx.Message Triggered after the chat message is sent.
chatReceived jabberwerx.Message Triggered when a chat message is received. The message should have a <body/>, and may contain an <error/>
threadUpdated N/A Triggered when the thread ID for a chat session is changed. thread is the new thread ID.
chatStateChanged
{
    // JID of the entity changing state
    jid: jabberwerx.JID,
    // The new chat state
    state: String
}
Triggered when the chat state changes.

jid is <null> if the current user's state changes. Otherwise, it is the JID of the entity whose state changed.

state is the new chat state, and is one of:

  • active
  • composing
  • gone
  • inactive
  • paused
lockedResourceChanged jabberwerx.JID Triggered when the resource this ChatSession is locked to changes. jid is the new full JID of the entity if the resource is different, or the bare JID if the previous resource is determined to be "stale".

jabberwerx.Client Events

Name Data Details Description
clientStatusChanged
{
    // previous status code
    prev: Number,
    // next status code
    next: Number,
    // describes the error, if any
    error: Error object
}
Triggered when a client's status changes. The status codes are one of:
beforeIqSent jabberwerx.IQ Triggered before an <iq/> stanza is sent. This event allows callbacks to modify the stanza before delivery.
iqSent jabberwerx.IQ Triggered after an <iq/> stanza is sent.
beforeIqReceived jabberwerx.IQ Triggered when an <iq/> stanza is received, before mainline processing[1]
iqReceived jabberwerx.IQ Triggered when an <iq/> stanza is received, during mainline processing[1]
afterIqReceived jabberwerx.IQ Triggered when an <iq/> stanza is received, after mainline processing[1]
beforeMessageSent jabberwerx.Message Triggered before a <message/> stanza is sent. This event allows callbacks to modify the stanza before delivery.
messageSent jabberwerx.Message Triggered after a <message/> stanza is sent.
beforeMessageReceived jabberwerx.Message Triggered when a <message/> stanza is received, before mainline processing[1]
messageReceived jabberwerx.Message Triggered when a <message/> stanza is received, during mainline processing[1]
afterMessageReceived jabberwerx.Message Triggered when a <message/> stanza is received, after mainline processing[1]
beforePresenceSent jabberwerx.Presence Triggered before a <presence/> stanza is sent. This event allows callbacks to modify the stanza before delivery.
presenceSent jabberwerx.Presence Triggered after a <presence/> stanza is sent.
beforePresenceReceived jabberwerx.Presence Triggered when a <presence/> stanza is received, before mainline processing[1]
presenceReceived jabberwerx.Presence Triggered when a <presence/> stanza is received, during mainline processing[1]
afterPresenceReceived jabberwerx.Presence Triggered when a <presence/> stanza is received, after mainline processing[1]
reconnectCountdownStarted Number Triggered when the auto reconnect starts its timer. The data is the number of seconds until the next reconnection attempt is made
reconnectCancelled N/A Triggered when the reconnect logic is cancelled.
clientConnected N/A Triggered when the client has successfully connected to the server.
clientDisconnected <error> Triggered when the client has successfully disconnected from the server.

Notes:

[1] If any callback triggered for these events returns true, then the overall event is considered handled: subsequent events are not triggered, and any built-in processessing (e.g. sending feature-not-implemented for iq's of type 'get' or 'set') is not performed.

jabberwerx.Entity Events

Name Data Details Description
primaryPresenceChanged
{
    // the full JID of the new primary
    fullJid: jabberwerx.JID,
    // the <presence/> of the new primary
    presence: jabberwerx.Presence
}
Triggered when the primary presence/availability of an entity changed. If there is no primary (e.g. all resources for an entity are offline), presence is <null> and fullJid is the bare JID of the entity.
resourcePresenceChanged
{
    // the triggering full JID
    fullJid: jabberwerx.JID,
    // the triggering <presence/> stanza
    presence: jabberwerx.Presence
}
Triggered whenever the presence/availability for an entity is changed. presence is the <presence/> stanza that triggered the change, and may be an "unavailable" presence.

jabberwerx.EntitySet Events

Name Data Details Description
entityAdded jabberwerx.Entity Triggered when an entity is added to the source entitySet.
entityRemoved jabberwerx.Entity Triggered when an entity is removed from the source entitySet.
entityUpdated jabberwerx.Entity Triggered when an entity's information is updated.
batchUpdateStarted N/A Triggered when a batch update to an entity set is started. Note: EntitySet events will fire normally during a batch. They can be suppressed by setting the jabberwerx.EntitySet.suppressBatchedEvents property to true
batchUpdateEnded
[{
    // name of batched event
    event: String,
    // Data associated with the batched event
    data: Object
}]
Triggered when a batch update to the entity cache is ended. The event's data is an array of all EntitySet events that fired during the batch.

jabberwerx.EntitySet Cache Events

NOTE: These events are provided by a number of different classes:

Name Data Details Description
entityCreated jabberwerx.Entity Triggered when an entity is created.
entityDestroyed jabberwerx.Entity Triggered when an entity is destroyed.
entityRenamed
{
    // The renamed entity (the entity.jid
    // and entity.node already updated)
    entity: jabberwerx.Entity,
    // The old jid (if any)
    jid:    jabberwerx.JID,
    // The old node (if any)
    node:   String
}
Triggered when an entity is renamed. The jid and node properites are the previous value for entity.

jabberwerx.RosterController Events

Name Data Details Description
rosterFetched N/A Triggered when RosterController has finished fetching and populating roster.
errorEncountered error: <error/> element An error occurred while trying to fetch the roster. The error element provides additional detail.
subscriptionReceived
{
    // the subscription presence stanza
    stanza: jabberwerx.Presence,
    // was the subscription handled automatically?
    handled: boolean
}
Triggered when a subscription request has been received. The event is triggered after automatic handling has been performed (auto accept, auto deny etc.).
unsubscriptionReceived
{
    // the unsubscribe presence stanza
    stanza: jabberwerx.Presence,
    // was the unsubscription handled automatically?
    handled: boolean
}
Triggered when a unsubscribe request has been received. The event is triggered after automatic handling has been performed (auto removal).

jabberwerx.DiscoController Events

Name Data Details Description
discoInitialized N/A Triggered when DiscoController has finished initializing.

jabberwerx.MUCController Events

Name Data Details Description
mucInviteReceived jabberwerx.MUCInvite Triggered when a direct (XEP-0249) or mediated (XEP-0045) MUC Room invite is received.

jabberwerx.MUCRoom Events

Name Data Details Description
roomCreated N/A Triggered when a MUC room has been created but not yet configured.
roomEntered N/A Triggered when a MUC room is entered.
roomExited N/A Triggered when a MUC room is exited.
beforeRoomBroadcastSent jabberwerx.Message Triggered before a broadcast message is sent to a MUC room. This event allows callbacks to modify the stanza before delivery.
roomBroadcastSent jabberwerx.Message Triggered after a broadcast message is sent.
roomBroadcastReceived jabberwerx.Message Triggered when a broadcast message from a room is received.
beforeRoomSubjectChanging jabberwerx.Message Triggered before a MUC room subject change request is sent. This event allows callbacks to modify the stanza before delivery.
roomSubjectChanging jabberwerx.Message Triggered after a MUC room subject change request is sent.
roomSubjectChanged jabberwerx.Message Triggered when a MUC room's subject has changed.
errorEncountered
{
    // operation method name
    operation: String,
    // error details
    error: <error/> element,
    // true if error due to user aborting action
    aborted: Boolean
}
Triggered when an error is encountered requesting a MUC room operation. The error is the XMPP <error/> child element describing the failure. The operation may be one of:
  • "changeNickname"
  • "changeSubject"
  • "enter"
  • "sendBroadcast"

jabberwerx.PubSubNode Events

Name Data Details Description
pubsubNodeCreated N/A Triggered when a PubSubNode is created.
pubsubNodeDeleted N/A Triggered when a PubSubNode is deleted.
pubsubItemsChanged
{
    // operation that caused the change
    operation: String,
    // list of affected items
    items: PubSubItems[]
}
Triggered when one or more items within a PubSubNode are changed. The items is an array of changed PubSubItems. The operation is one of:
  • "added"
  • "updated"
  • "removed"
errorEncountered
{
    // operation method name
    operation: String,
    // error details
    error: <error/> element
}
Triggered when an error is encountered requesting a PubSub node operation. The error is the XMPP <error/> child element describing the failure. The operation may be one of:
  • "createNode"
  • "deleteNode"
  • "publish"
  • "retract"
  • "retrieve"
  • "subscribe"
  • "unsubscribe"

jabberwerx.PrivacyListController Events

Name Data Details Description
errorEncountered
{
    // operation method name
    operation: String,
    // error details
    error: <error/> element,
    // The privacy list targeted by the operation (if any)
    target: jabberwerx.PrivacyList
Triggered when an error is encountered requesting a privacy list operation. The error is the XMPP <error/> child element describing the failure. The operation may be one of:
  • "apply"
  • "fetch"
  • "remove"
  • "update"
For all operations except "apply", target is the PrivacyList object the operation targeted.
privacyListApplied
{
    // name of applied list
    // or undefined if there is no active list
    name: String
}
Triggered when the active list for this resource is changed or removed.
privacyListUpdated jabberwerx.PrivacyList Triggered when a privacy list is created or changed.
privacyListRemoved jabberwerx.PrivacyList Triggered when a privacy list has been deteled from the server.

jabberwerx.RosterController Events

Name Data Details Description
subscriptionReceived
{
    // <presence/> stanza of the request
    stanza: jabberwerx.Presence,
    // <true> if the request has been
    // auto accepted
    handled: Boolean
}
Triggered when a subscription request is received. The <handled> flag indicates if the auto-accept logic has already accepted and handled the subscription request.
unsubscriptionReceived
{
    // <presence/> stanza of the request
    stanza: jabberwerx.Presence,
    // <true> if the request has been
    // auto removed
    handled: Boolean
}
Triggered when an unsubscription request is received. The <handled> flag indicates if the auto-remove logic has already acknowledged and handled the unsubscription request.
errorEncountered
{
    operation: "fetch",
    error: <error/> element
}
Triggered when an error is encountered fetching the roster. The error is the XMPP <error/> child element describing the failure.

{jabberwerx.Stream} Events

Name Data Details Description
streamClosed <stream:error/> element

Triggered when a stream is closed. The data is present if the stream did not close gracefully.

NOTE: This event may be triggered before the stream is opened, e.g. there are network errors opening the stream.

streamElementsReceived jQuery-wrapped array of elements Triggered when elements are received from the remote endpoint. The event data always contains at least one element.
streamElementsSent jQuery-wrapped array of elements Triggered when elements are sent to the remote endpoint. The event data always contains at least one element.
streamOpened <stream:features/> element Triggered when the stream is opened. The event data is the set of features reported by the remote endpoint.

UI Events

JWView Events

Name Data Details Description
viewRendered jQuery(Element) Triggered after the view is rendered, but before it is placed into the document. This event allows callbacks to modify the view.
viewRemoved jQuery(Element) Triggered after the view is removed from the document.
viewActivated
{
    //Type of activation
    type: String
}
Triggered when a view is activated. The <type> depends on the browser event that initiated it, typically "click" (mouse click on the view).
viewDeactivated
{
    //Type of deactivation
    type: String
}
Triggered when a view is deactivated. The <type> depends on the browser event that initiated it, typically "blur" (focus moved to a different widget/view).

jabberwerx.ui.MUCInviteView Events

Name Data Details Description
actionComplete
{
    // The user's action
    action: String,
    [error]: <error/> element
}
Triggered when a user chooses an action to complete the MUC invite request. This value is one of:
If the action is ACTION_JOIN, an optional error property may be present. If present, an error occurred while trying to join the room and this object describes the error. The error is the XMPP <error/> child element describing the failure.

jabberwerx.ui.RosterView Events

Name Data Details Description
rosterGroupingRendered
{
    // The rendered Grouping
    grouping: jabberwerx.ui.RosterView.Grouping,
    // The rendered Grouping's DOM
    dom: jQuery
}
Triggered when a Grouping (not an item) in the roster is rendered.
rosterItemRendered
{
    // The rendered Item
    item: jabberwerx.ui.ContactPresenceView,
    // The rendered item's DOM
    dom: jQuery
}
Triggered when an item (not a Grouping) in the roster is rendered.
rosterItemSelected
{
    // The type of selection
    type: String,
    // The selected item
    item: jabberwerx.ui.ContactPresenceView
}
Triggered when an item (not a Grouping) in the roster is selected. <type> denotes how the selection was made; this is one of:
  • click

jabberwerx.ui.SelfPresenceView Events

Name Data Details Description
presenceSelected
{
    //selected show value
    show: {String},
    //selected status value
    status: {String},
     //priority value (defaults to null)
    priority: {Number|null}
}

Triggered when a choice is selected, but before any <presence/> is sent out. Callbacks may change any or all of these values, and the changes will be included in the <presence/> that is sent.

Any callback returning true will prevent this SelfPresenceView from sending a <presence/>, allowing callbacks to perform specialized handling (e.g. adding "Custom..." to prompt the user to enter a new status value).

jabberwerx.ui.SubscriptionView Events

Name Data Details Description
actionComplete
{
    // The user's action
    action: String
}
Triggered when a user chooses an action to complete the subscription request. This value is one of:

jabberwerx.ui.TabbedView Events

Name Data Details Description
tabActivated
jabberwerx.ui.TabbedView.Tab
Triggered when a tab was activated. This event is usually preceeded by a "tabDeactivated" event.
tabDeactivated
jabberwerx.ui.TabbedView.Tab
Triggered when a tab was deactivated. This event is usually succeeded by a "tabActivated" event.

jabberwerx.ui.XDataFormView Events

Name Data Details Description
xdataItemSelected
{
    // The selected item
    selected: jabberwerx.XDataFormItem
}
Triggered when item in the result set is clicked on.

jabberwerx.ui.TextInput Events

Name Data Details Description
textSend String Triggered when a text is to be processed for sending. Any callback that returns true has indicated the sent data is processed, which causes any outstanding idle timers to be cancelled and the typed input to be cleared.
textTypingStarted String

Triggered when it is determined the user has started typing.

This condition would equate to the "composing" chat state.

textTypingEnded N/A

Triggered when it is detemrined the user stopped typing, but did not request data to be sent (e.g. cleared out the text area).

This condition would equate to the "active" chat state, without sending any chat body.

textTypingIdled N/A

Triggered when it is determined the user has suspended typing for an extended amount of time.

This condition would equate to the "paused" chat state.

jabberwerx.ui.MessageHistory Events

Name Data Details Description
historyMessageAppended jQuery(Element) Triggered when a message is about to be added to the MessageHistory window. You can change the jQuery object in place and those changes will be reflected in the MessageHistory window.

jabberwerx.ui.MUCSearchView Events

Name Data Details Description
actionComplete
{
    // The user's action
    action: String,
    submitted: jabberwerx.MUCRoom
}
Triggered when a user has selected a room and clicked the 'join' button:
The 'action' property will be the following value:

jabberwerx.cisco Events

DirectoryGroupsController Events

Name Data Details Description
LDAPContactAdded
{
    // Group user name
    username: String,
    // Group's ID
    groupid: String,
    // How user should be displayed
    displayName: String
}
Triggered when a user is added to a group or as each new user is added during a member fetch.
LDAPContactRemoved
{
    // The node ID of the removed contact
    id: String,
    // Group's ID
    groupid: String
}
Triggered after the view is removed from the document.
LDAPGroupRemoved
{
    // ID of removed group
    groupid: String
}
Triggered when an entire group has been deleted.
LDAPGroupNameUpdated
{
    // ID of upgraded group
    groupid: String,
    // Group's new name
    groupname: String
}
Triggered when a group has changed names.
LDAPGroupSearchResults
{
    // ID of the current search (see xep-0055)
    resultid: String,
    // Result fields
    ldapGroups: Array of {
        // One Group's ID
        groupid: String,
        // And its name
        groupname: String
    }
}
Triggered when the results of requested group search are returned.
LDAPUserSearchResults
{
    // ID of the current search (see xep-0055)
    resultid: String,
    // Result fields
    ldapUsers: Array of {
        // Member's name
        username: String,
        // Member's display name
        displayname: String,
        // Other metadata
        email: String,
        jobtitle: String,
        phone: String
    }
}
Triggered when the results of a requested user search are returned.

{event.source} Events

Name Data Details Description
{event.name} {event.data} {event.desc}


THE SPECIFICATIONS AND INFORMATION REGARDING THE PRODUCTS IN THIS MANUAL ARE SUBJECT TO CHANGE WITHOUT NOTICE. ALL STATEMENTS, INFORMATION, AND RECOMMENDATIONS IN THIS MANUAL ARE BELIEVED TO BE ACCURATE BUT ARE PRESENTED WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. USERS MUST TAKE FULL RESPONSIBILITY FOR THEIR APPLICATION OF ANY PRODUCTS.

THE SOFTWARE LICENSE AND LIMITED WARRANTY FOR THE ACCOMPANYING PRODUCT ARE SET FORTH IN THE INFORMATION PACKET THAT SHIPPED WITH THE PRODUCT AND ARE INCORPORATED HEREIN BY THIS REFERENCE. IF YOU ARE UNABLE TO LOCATE THE SOFTWARE LICENSE OR LIMITED WARRANTY, CONTACT YOUR CISCO REPRESENTATIVE FOR A COPY.

The Cisco implementation of TCP header compression is an adaptation of a program developed by the University of California, Berkeley (UCB) as part of UCB's public domain version of the UNIX operating system. All rights reserved. Copyright © 1981, Regents of the University of California.

NOTWITHSTANDING ANY OTHER WARRANTY HEREIN, ALL DOCUMENT FILES AND SOFTWARE OF THESE SUPPLIERS ARE PROVIDED "AS IS" WITH ALL FAULTS. CISCO AND THE ABOVE-NAMED SUPPLIERS DISCLAIM ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THOSE OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE.

IN NO EVENT SHALL CISCO OR ITS SUPPLIERS BE LIABLE FOR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, OR INCIDENTAL DAMAGES, INCLUDING, WITHOUT LIMITATION, LOST PROFITS OR LOSS OR DAMAGE TO DATA ARISING OUT OF THE USE OR INABILITY TO USE THIS MANUAL, EVEN IF CISCO OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental.

Cisco and the Cisco logo are trademarks or registered trademarks of Cisco and/or its affiliates in the U.S. and other countries. To view a list of Cisco trademarks, go to this URL:http://www.cisco.com/go/trademarks. Third-party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1110R)

© 2014 Cisco Systems, Inc. All rights reserved.