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.

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.

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:

{event.source} Events

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


© 2011 Cisco Systems, Inc. All rights reserved.

CCDE, CCENT, CCSI, Cisco Eos, Cisco Explorer, Cisco HealthPresence, Cisco IronPort, the Cisco logo, Cisco Nurse Connect, Cisco Pulse, Cisco SensorBase, Cisco StackPower, Cisco StadiumVision, Cisco TelePresence, Cisco TrustSec, Cisco Unified Computing System, Cisco WebEx, DCE, Flip Channels, Flip for Good, Flip Mino, Flipshare (Design), Flip Ultra, Flip Video, Flip Video (Design), Instant Broadband, and Welcome to the Human Network are trademarks; Changing the Way We Work, Live, Play, and Learn, Cisco Capital, Cisco Capital (Design), Cisco:Financed (Stylized), Cisco Store, Flip Gift Card, and One Million Acts of Green are service marks; and Access Registrar, Aironet, AllTouch, AsyncOS, Bringing the Meeting To You, Catalyst, CCDA, CCDP, CCIE, CCIP, CCNA, CCNP, CCSP, CCVP, Cisco, the Cisco Certified Internetwork Expert logo, Cisco IOS, Cisco Lumin, Cisco Nexus, Cisco Press, Cisco Systems, Cisco Systems Capital, the Cisco Systems logo, Cisco Unity, Collaboration Without Limitation, Continuum, EtherFast, EtherSwitch, Event Center, Explorer, Follow Me Browsing, GainMaker, iLYNX, IOS, iPhone, IronPort, the IronPort logo, Laser Link, LightStream, Linksys, MeetingPlace, MeetingPlace Chime Sound, MGX, Networkers, Networking Academy, PCNow, PIX, PowerKEY, PowerPanels, PowerTV, PowerTV (Design), PowerVu, Prisma, ProConnect, ROSA, SenderBase, SMARTnet, Spectrum Expert, StackWise, WebEx, and the WebEx logo are registered trademarks of Cisco and/or its affiliates in the United States and certain other countries. All other trademarks mentioned in this document or website 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. (1002R)