Class jabberwerx.Client (MINIMAL)
Extends
jabberwerx.JWModel.
Constructor Attributes | Constructor Name and Description |
---|---|
jabberwerx.Client(resourceName)
|
Field Attributes | Field Name and Description |
---|---|
Whether auto-registration is active. |
|
The current client status. |
|
The server to which we are currently connected. |
|
The user with whose JID we are currently logged in. |
|
The collection of registered Controllers for this Client. |
|
This entity set must be used to get references to any entity needed for the lifetime of this client/connection. |
|
The resource name for this client. |
|
<static> <constant> |
jabberwerx.Client.status_connected
|
<static> <constant> |
jabberwerx.Client.status_connecting
|
<static> <constant> |
jabberwerx.Client.status_disconnected
|
<static> <constant> |
jabberwerx.Client.status_disconnecting
|
<static> <constant> |
jabberwerx.Client.status_reconnecting
|
Method Attributes | Method Name and Description |
---|---|
Cancels a reconnect if one is currently in the pipeline. |
|
connect(jid, password, arg)
Connect to the XMPP server. |
|
destroy()
Destroys this client. |
|
Disconnect from the server. |
|
Gets all presence objects for the jid specified. |
|
getClientStatusString(status)
|
|
getCurrentPresence(primary)
Retrieves the current presence for this client. |
|
Gets the primary presence for the jid specified. |
|
isSecure()
Determines if this client is connected in a secure or trusted manner. |
|
selectNodes(stanzaDoc, selector)
Runs the passed jQuery selector string against the passed stanza. |
|
sendIq(type, to, content, callback, timeout)
Send an XMPP IQ stanza. |
|
sendIQ(type, to, content, callback, timeout)
Alias for jabberwerx.Client#sendIq. |
|
sendMessage(to, body, subject, type, thread)
Send an XMPP message. |
|
sendPresence(show, status, to)
Send an XMPP presence stanza |
|
sendStanza(rootName, type, to, content)
Send an XMPP stanza. |
- Methods borrowed from class jabberwerx.JWModel:
- applyEvent, event, shouldBeSavedWithGraph
- Methods borrowed from class jabberwerx.JWBase:
- extend, getClassName, graphUnserialized, init, intercept, invocation, mixin, shouldBeSerializedInline, toString, wasUnserialized, willBeSerialized
- Parameters:
- {String} resourceName Optional
- the client resource name to use.
Whether auto-registration is active.
The current client status.
The server to which we are currently connected.
The user with whose JID we are currently logged in.
The collection of registered Controllers for this Client. Controllers are responsible for registering themselves with their owning client.
This entity set must be used to get references to any entity needed for the lifetime of this client/connection.
The resource name for this client.
Cancels a reconnect if one is currently in the pipeline. Triggers the reconnectCancelled event.
Connect to the XMPP server. the value of {arg} is expected to be an object with any of the following properties:
Name | Type | Description |
---|---|---|
httpBindingURL | String | URL for BOSH connection |
httpBindingURL_secondary | String | The secondary/backup URL for BOSH connection |
serviceDiscoveryEnabled | Boolean | The flag to indicate whether the service discovery is on or off on the client. |
successCallback | Function | Called when
the client successfully connects. It is expected to have the
following signature:
function success() { this; //The client } |
errorCallback | Function | Called when
the client fails to connect. It is expected to have the
following signature:
function failed(err) { this; //The client err; //An object describing the error } |
- Parameters:
- {jabberwerx.JID|String} jid
- The JID to connect to the XMPP server. If anonymous login is required, only specify the domain as the jid i.e. "example.com"
- {String} password Optional
- The password for the given JID. If using anonymous login (i.e. the domain is passed as the jid value) the password argument is optional.
- {Object} arg
- Object containing the arguments to connect with.
Destroys this client. This method walks through all of the controllers, destroying them.
Disconnect from the server.
Gets all presence objects for the jid specified. Usual usage would be for bare jids. If a full jid is passed through then only one presence object will be returned in the array.
- Parameters:
- {String|jabberwerx.JID} jid
- The jid to get all presence for
- Returns:
- An array of jabberwerx.Presence objects. Note that this array may be empty if no presence objects are attached to this jid's entity
- Parameters:
- {Number} status
- A Client.status_... constant
- Returns:
- A string version of the status.
Retrieves the current presence for this client. If not connected, this method returns null.
- Parameters:
- {Boolean} primary Optional
- Optional flag which, if true, this method will return the primary presence for this client. If false or not specified, the resource presence is retrieved.
- Returns:
- {jabberwerx.Presence} The current presence, or null if none
Gets the primary presence for the jid specified. If the jid is in bare jid format (ex. 'user@host') then the highest priority presence for that entity will be returned. If the jid is in full jid format (ex. 'user@host/resource') then the presence object for that resource only will be returned.
- Parameters:
- {String|jabberwerx.JID} jid
- The jid to get the primary presence of
- Returns:
- The primary presence or null if the entity / resource for this jid does not exist
- Returns:
- Whether the client is currently connected
Determines if this client is connected in a secure or trusted manner.
- Returns:
- true If the stream is considered secure
Runs the passed jQuery selector string against the passed stanza.
- Parameters:
- {String} stanzaDoc
- XML of stanza
- {String} selector
- jQuery selector
- Returns:
- A bare array (not jQuery-enhanced) of matching nodes, or a single node if only one matches.
Send an XMPP IQ stanza.
- Parameters:
- {String} type
- The type attribute to set on the iq.
- {String} to
- The to attribute to set on the iq.
- {String} content
- XML content of the iq stanza.
- {Function} callback Optional
- A callback to be invoked when either an IQ is recieved with a matching id, or {null} if {timeout} is reached.
- {Number} timeout Optional
- A timeout (in seconds) wait on a result or error IQ with a matching id
- Throws:
- TypeError If {callback} is defined and is not a function; or if {timeout} is defined and not a number
- Returns:
- The id set on the outgoing stanza.
Alias for jabberwerx.Client#sendIq.
- Parameters:
- type
- to
- content
- callback
- timeout
Send an XMPP message. Assumes chat-type content with a body.
- Parameters:
- {String} to
- The to attribute to set on the message.
- {String} body
- The body of the message.
- {String} subject Optional
- The subject of the message
- {String} type Optional
- The type attribute to set on the message.
- {String} thread Optional
- A thread identifier, if any.
Send an XMPP presence stanza
- Parameters:
- {String} show Optional
- Optional show value: 'away', 'available', 'dnd', etc.
- {String} status Optional
- Optional status message.
- {String} to Optional
- Optional `to` attribute to set on the outgoing stanza.
Send an XMPP stanza.
If {rootName} is an instance of jabberwerx.Stanza, this method ignores all other properties and sends the stanza directly. Otherwise, it is expected to be the name of the root node (e.g. presence, iq, message).
- Parameters:
- {jabberwerx.Stanza|Element|String} rootName
- The name of the root node (presence, iq, etc), or the object representation of the stanza.
- {String} type
- The type attribute to set on the root, if any. (Set to '' or null to not set a type).
- {String} to
- The to attribute to set on the root, if any. (Set to '' or null to not set a type).
- {String} content
- XML content of the stanza.