Class Index Minimal

Classes


Class jabberwerx.PubSubNode


Extends jabberwerx.Entity.

Represents a publish-subscribe node.

This class provides the following events:

Class Summary
Constructor Attributes Constructor Name and Description
 
jabberwerx.PubSubNode(jid, node, ctrl)

Creates a new PubSubNode for the given JID, node, and PubSubController (or delegate).

Field Summary
Field Attributes Field Name and Description
 

Flag to determine if items are automatically retrieved from the pubsub node upon subscription.

Fields borrowed from class jabberwerx.Entity:
features, identities, jid, node, properties
Method Summary
Method Attributes Method Name and Description
 

Creates the node on the pubsub service.

 

Deletes the node on the pubsub service.

 

Destroys this PubSubNode.

 

Retrieves the delegated PubSubNode for the given JID.

 

Retrieves the current items for this PubSubNode.

 
publish(id, payload, cb)

Publishes an item to this PubSubNode.

 
retract(id, cb)

Retracts an item from this PubSubNode.

 

Retrieves the items for this PubSubNode.

 

Subscribes to this PubSubNode.

 

Unsubscribes from this PubSubNode.

Methods borrowed from class jabberwerx.Entity:
apply, getAllPresence, getDisplayName, getGroups, getPrimaryPresence, getResourcePresence, hasFeature, hasIdentity, isActive, matches, remove, setDisplayName, setGroups, toString, update, updatePresence
Methods borrowed from class jabberwerx.JWModel:
applyEvent, event, shouldBeSavedWithGraph
Methods borrowed from class jabberwerx.JWBase:
extend, getClassName, graphUnserialized, init, intercept, invocation, mixin, shouldBeSerializedInline, wasUnserialized, willBeSerialized
Class Detail
jabberwerx.PubSubNode(jid, node, ctrl)

Creates a new PubSubNode for the given JID, node, and PubSubController (or delegate).

If this PubSubNode is created with a delegate, the owning controller is the delegate's controller. A delegated PubSubNode (one that has a delegate) is mostly just a container of published items, relying on the delegate to perform most operations.

NOTE: This type should not be constructed directly. Instead, use jabberwerx.PubSubController#node to obtain an instance.

Parameters:
{jabberwerx.JID} jid
The JID
{String} node
The node
{jabberwerx.PubSubController|jabberwerx.PubSubNode} ctrl
The owning controller or delegate
Throws:
{TypeError}
If {ctrl} is not valid; or if {node} is not valid
Field Detail
{Boolean} autoRetrieve

Flag to determine if items are automatically retrieved from the pubsub node upon subscription.

Method Detail
createNode(cb)

Creates the node on the pubsub service.

The callback, if defined, is expected to match the following:

 function callback(err) {
     this;   // this PubSubNode
     err;    // the stanza error if create failed
 }
Parameters:
{Function} cb Optional
The callback
Throws:
{TypeError}
If {cb} is not valid.
{jabberwerx.Client.NotConnectedError}
If the client is not connected
{jabberwerx.PubSubNode.DelegatedNodeError}
If this is a delegated node

deleteNode(cb)

Deletes the node on the pubsub service.

The callback, if defined, is expected to match the following:

 function callback(err) {
     this;   // this PubSubNode
     err;    // the stanza error if create failed
 }
Parameters:
{Function} cb Optional
The callback
Throws:
{TypeError}
If {cb} is not valid.
{jabberwerx.Client.NotConnectedError}
If the client is not connected
{jabberwerx.PubSubNode.DelegatedNodeError}
If this is a delegated node

destroy()

Destroys this PubSubNode. This method unbinds registered callbacks, destroys any delegated PubSubNodes, and then calls the superclass' implementation.


{jabberwerx.PubSubNode} getDelegatedFor(jid)

Retrieves the delegated PubSubNode for the given JID. If such a delegated node does not exist, one is created.

Parameters:
{String|jabberwerx.JID} jid
The JID of the delegated node
Throws:
{TypeError}
if {jid} is not a valid JID
{jabberwerx.PubSubNode.DelegatedNodeError}
If this PubSubNode is already delegated.
Returns:
{jabberwerx.PubSubNode} The delegated node

{jabberwerx.PubSubItem[]} getItems()

Retrieves the current items for this PubSubNode. The returned array's items are indexed by both the natural array index (e.g. items[0], items[1]) and by the "item:{item.id}" (e.g. items["item:current"], items["item:some-random-id"]).

Returns:
{jabberwerx.PubSubItem[]} The current items

publish(id, payload, cb)

Publishes an item to this PubSubNode.

The callback, if defined, is expected to match the following:

 function callback(err) {
     this;   // this PubSubNode
     err;    // the stanza error if publish failed
 }
Parameters:
{String} id Optional
The item id
{Element} payload Optional
The item payload
{Function} cb Optional
The callback
Throws:
{TypeError}
If {cb} is not valid; If {paylaod} is defined and not an Element
{jabberwerx.Client.NotConnectedError}
If the client is not connected

retract(id, cb)

Retracts an item from this PubSubNode.

The callback, if defined, is expected to match the following:

 function callback(err) {
     this;   // this PubSubNode
     err;    // the stanza error if retract failed
 }
Parameters:
{String} id
The item id
{Function} cb Optional
The callback
Throws:
{TypeError}
If {cb} is not valid; if {id} is empty or not a string
{jabberwerx.Client.NotConnectedError}
If the client is not connected

retrieve(cb)

Retrieves the items for this PubSubNode. This method updates the list of items returned by #getItems with the current remote state of the node.

The callback, if defined, is expected to match the following:

 function callback(err) {
     this;   // this PubSubNode
     err;    // the stanza error if retrieve failed
 }
Parameters:
{Function} cb Optional
The callback
Throws:
{TypeError}
If {cb} is defined and not a function
{jabberwerx.Client.NotConnectedError}
If the client is not connected
See:
#getItems

subscribe(cb)

Subscribes to this PubSubNode. This method sends the explicit subscription request to the node, using the connected user's bare JID.

The callback, if defined, is expected to match the following:

 function callback(err) {
     this;   // this PubSubNode
     err;    // the stanza error if subscribe failed
 }
Parameters:
{Function} cb Optional
The callback
Throws:
{TypeError}
If {cb} is defined and not a function
{jabberwerx.Client.NotConnectedError}
If the client is not connected
See:
#unsubscribe

unsubscribe(cb)

Unsubscribes from this PubSubNode. This method sends the explicit unsubscription request to the node.

The callback, if defined, is expected to match the following:

 function callback(err) {
     this;   // this PubSubNode
     err;    // the stanza error if unsubscribe failed
 }
Parameters:
{Function} cb Optional
The callback
Throws:
{TypeError}
If {cb} is defined and not a function
{jabberwerx.Client.NotConnectedError}
If the client is not connected
See:
#subscribe

Documentation generated by JsDoc Toolkit 2.0.1 on Thu Aug 18 2011 10:58:50 GMT+0100 (IST)