Namespace jabberwerx (MINIMAL)
Cisco AJAX XMPP Library is an easy to use, AJAX-based XMPP client. This namespace contains the core, non-UI classes and methods.
To use these features you must have an account on an XMPP server.
Events
The Cisco AJAX XMPP Library eventing mechanism is implemented in jabberwerx.EventDispatcher and jabberwerx.EventNotifier. Any possible event that may be fired will trigger on jabberwerx.globalEvents. See JabberWerx Events for all possible events.
Configuration
The following configuration options are available:
| Name | Default | Description |
|---|---|---|
| persistDuration | 30 | The number of seconds that persisted data is considered to still be valid. |
| capabilityFeatures | [] | The base capabilities for clients, not including those defined by enabled controllers |
| capabilityIdentity | {
category: "client",
type: "pc",
name: "JabberWerx AJAX",
node: "http://jabber.cisco.com/jabberwerx"
} |
The identity for clients' capabilities. |
| unsecureAllowed | false | true if plaintext authentication is allowed over unencrypted or unsecured HTTP channels |
| baseReconnectCountdown | 30 | base number of seconds between a disconnect occurring and a reconnect been initiated. The actual reconnect period will be the {baseReconnectCountdown} +/- x%, where x is a random number between 0 and 10. If {baseReconnectCountdown} is 0 then a reconnect will never be attempted. {baseReconnectCountdown} is also used as a persist password flag. If 0 password is never persisted and is cleared from memory as soon as possible (immediately after a connect ATTEMPT. IF > 0, password is persisted obfuscated and the password remains in memory (accessable through the client.connectParams object) |
| bindRetryCountdown | 30 | Number of seconds timeout between sending a bind resource request and receiving the response from server. If no response from server after this timeout period, a reconnect operation will be processed. If {bindRetryCountdown} is less than or equal 0, the default value 30 seconds will be used. |
| enabledMechanisms | ["DIGEST-MD5", "PLAIN"] | The list of SASL mechanism to enable by default. |
To set any of these options, create an object called jabberwerx_config
in the global namespace, like this:
jabberwerx_config = {
persistDuration: 30,
unsecureAllowed: false,
capabilityFeatures: ['http://jabber.org/protocol/caps',
'http://jabber.org/protocol/chatstates',
'http://jabber.org/protocol/disco#info',
'http://jabber.org/protocol/muc',
'http://jabber.org/protocol/muc#user'],
capabilityIdentity: {
category: 'client',
type: 'pc',
name: 'JabberWerx AJAX',
node: 'http://jabber.cisco.com/jabberwerx'},
baseReconnectCountdown: 30,
bindRetryCountdown: 30,
enabledMechanisms: ["DIGEST-MD5", "PLAIN"]
};
This code must be evaluated before including this file, jabberwerx.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Cisco AJAX XMPP Library is an easy to use, AJAX-based XMPP client. |
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
jabberwerx.errorReporter
The singleton object of ErrorReporter. |
| <static> |
jabberwerx.globalEvents
The global event dispatcher. |
| <static> |
jabberwerx.l10n
The global translator instance. |
| <static> |
jabberwerx.sasl
The global SASL factory. |
| <static> |
jabberwerx.version
JabberWerx Version |
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
jabberwerx._(istr)
Localizes and formats the given input string. |
| <static> |
jabberwerx.generateTimestamp(ts, legacy)
Converts a Date object into an XMPP-formatted date/time string. |
| <static> |
jabberwerx.isDocument(o)
Check whether the given node {o} is a document node |
| <static> |
jabberwerx.isElement(o)
Check whether the given NODE {o} is an element node |
| <static> |
jabberwerx.isText(o)
Check whether the given node {o} is a TextNode |
| <static> |
jabberwerx.parseTimestamp(timestamp)
Converts an XMPP-formatted date/time string into a Javascript Date object. |
| <static> |
jabberwerx.reduce(obj, fn, value)
Performs a "reduce" on the given object (array or otherwise). |
| <static> |
jabberwerx.reset()
Disconnects from the server and clears any stored chat sessions. |
| <static> |
jabberwerx.unique(arr)
Removes duplicate items from the given array. |
Cisco AJAX XMPP Library is an easy to use, AJAX-based XMPP client. This namespace contains the core, non-UI classes and methods.
To use these features you must have an account on an XMPP server.
Events
The Cisco AJAX XMPP Library eventing mechanism is implemented in jabberwerx.EventDispatcher and jabberwerx.EventNotifier. Any possible event that may be fired will trigger on jabberwerx.globalEvents. See JabberWerx Events for all possible events.
Configuration
The following configuration options are available:
| Name | Default | Description |
|---|---|---|
| persistDuration | 30 | The number of seconds that persisted data is considered to still be valid. |
| capabilityFeatures | [] | The base capabilities for clients, not including those defined by enabled controllers |
| capabilityIdentity | {
category: "client",
type: "pc",
name: "JabberWerx AJAX",
node: "http://jabber.cisco.com/jabberwerx"
} |
The identity for clients' capabilities. |
| unsecureAllowed | false | true if plaintext authentication is allowed over unencrypted or unsecured HTTP channels |
| baseReconnectCountdown | 30 | base number of seconds between a disconnect occurring and a reconnect been initiated. The actual reconnect period will be the {baseReconnectCountdown} +/- x%, where x is a random number between 0 and 10. If {baseReconnectCountdown} is 0 then a reconnect will never be attempted. {baseReconnectCountdown} is also used as a persist password flag. If 0 password is never persisted and is cleared from memory as soon as possible (immediately after a connect ATTEMPT. IF > 0, password is persisted obfuscated and the password remains in memory (accessable through the client.connectParams object) |
| bindRetryCountdown | 30 | Number of seconds timeout between sending a bind resource request and receiving the response from server. If no response from server after this timeout period, a reconnect operation will be processed. If {bindRetryCountdown} is less than or equal 0, the default value 30 seconds will be used. |
| enabledMechanisms | ["DIGEST-MD5", "PLAIN"] | The list of SASL mechanism to enable by default. |
To set any of these options, create an object called jabberwerx_config
in the global namespace, like this:
jabberwerx_config = {
persistDuration: 30,
unsecureAllowed: false,
capabilityFeatures: ['http://jabber.org/protocol/caps',
'http://jabber.org/protocol/chatstates',
'http://jabber.org/protocol/disco#info',
'http://jabber.org/protocol/muc',
'http://jabber.org/protocol/muc#user'],
capabilityIdentity: {
category: 'client',
type: 'pc',
name: 'JabberWerx AJAX',
node: 'http://jabber.cisco.com/jabberwerx'},
baseReconnectCountdown: 30,
bindRetryCountdown: 30,
enabledMechanisms: ["DIGEST-MD5", "PLAIN"]
};
This code must be evaluated before including this file, jabberwerx.js.
The singleton object of ErrorReporter. Use this instead of creating a new ErrorReporter object.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/model/ErrorReporter.js>.
The global event dispatcher. Callbacks registered on this dispatcher are executed when any event of a given name is triggered.
The list of all known events are found in JabberWerx AJAX Events.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/model/Events.js>.
The global translator instance. Use this instead of creating new instances of Translator.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/model/Translator.js>.
The global SASL factory.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/model/SASL.js>.
- See:
- jabberwerx.SASLMechanismFactory#mechanisms
- jabberwerx.SASLMechanismFactory#createMechanismFor
- jabberwerx.SASLMechanismFactory#addMechanism
- jabberwerx.SASLMechanismFactory#removeMechanism
JabberWerx Version
Localizes and formats the given input string. This method performs the same operations as jabberwerx.Translator#format, but as a singleton method.
Defined in: </clearcase/jetty-7.0.1/jobs/VTG_CAXL_8.6 Build/workspace/vtg_caxl_8.6/build/dist/VTG-CAXL-debug-8.6.1.28927/src/model/Translator.js>.
- Parameters:
- {String} istr
- The input string
- Returns:
- {String} The formatted/localized string
Converts a Date object into an XMPP-formatted date/time string.
- Parameters:
- {Date} ts
- The date object to generate from
- {Boolean} legacy Optional
- true if the date/time string should conform to the legacy format in XEP-0091
- Throws:
- {TypeError}
- If {ts} is not a Date object
- Returns:
- {String} The date/time string
Check whether the given node {o} is a document node
- Parameters:
- {Node} o
- The node to check against
- Returns:
- {Boolean} true if {o} is a document node
Check whether the given NODE {o} is an element node
- Parameters:
- {Node} o
- The node to check against
- Returns:
- {Boolean} true if {o} is an element node
Check whether the given node {o} is a TextNode
- Parameters:
- {Node} o
- The object to check against
- Returns:
- {Boolean} true if {o} is a TextNode
Converts an XMPP-formatted date/time string into a Javascript Date object.
- Parameters:
- {String} timestamp
- The timestamp string to parse from
- Throws:
- {TypeError}
- If {timestamp} cannot be parsed
- Returns:
- {Date} The date object representing the timestamp
Performs a "reduce" on the given object (array or otherwise). This method iterates over the items in <obj>, calling <fn> with the current item from <obj> and the current <value>.
The signature for <fn> is expected to take two arguments: The current item from <obj> to evaluate, and the current value of the reduction. <fn> is expected to return the updated value.
For example, the following sums all of the items in an array:
- Parameters:
- {Object|Array} obj
- The object to reduce
- {Function} fn
- The callback to perform the reduction
- value Optional
- The initial value for reduction; may be undefined
- Throws:
- {TypeError}
- If {fn} is not a function object.
- Returns:
- The reduction value
Disconnects from the server and clears any stored chat sessions.
Removes duplicate items from the given array.
- Parameters:
- {Array} arr
- The array to make unique
- Returns:
- {Array} The provided array {arr}