Package spade :: Module pubsub :: Class PubSub
[hide private]
[frames] | no frames]

Class PubSub

source code


Nested Classes [hide private]
  _sendAndReceiveBehav
Instance Methods [hide private]
 
__init__(self, agent)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_sendAndReceive(self, iq, getContents) source code
(string , list[string])
publish(self, node, event=None)
Publishes an item to a given node.
source code
(string , list[string])
subscribe(self, node, server=None, jid=None)
Subscribes to the selected node
source code
(string , list[string])
unsubscribe(self, node, server=None, jid=None)
Unsubscribe from the selected node
source code
(string , list[string])
createNode(self, node, server=None, type='leaf', parent=None, access=None)
Creates a node with the specified parameters.
source code
 
createInstantNode(self, server=None, type='leaf', parent=None, access=None)
Creates an instant node without a name.
source code
(string , list[string])
deleteNode(self, node, server=None)
Deletes the selected node.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, agent)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

publish(self, node, event=None)

source code 

Publishes an item to a given node.

XXX: 'node' here is not an XML node, but the attribute for <publish>

Parameters:
  • node (string) - The ID of the pubsub node to publish
  • event (Event) - Content to publish
Returns: (string , list[string])
A tuple with the type of answer ('ok','error') and information about the answer. In case of 'error', a list with the errors. In case of 'ok' the name of the created node.

subscribe(self, node, server=None, jid=None)

source code 

Subscribes to the selected node

Parameters:
  • node (string) - id of the node to delete
  • server (string) - PubSub server
Returns: (string , list[string])
A tuple with the type of answer ('ok','error') and information about the answer. In case of 'error', a list with the errors. In case of 'ok', an empty list.

unsubscribe(self, node, server=None, jid=None)

source code 

Unsubscribe from the selected node

Parameters:
  • node (string) - id of the node to unsubscribe
  • server (string) - PubSub server
Returns: (string , list[string])
A tuple with the type of answer ('ok','error') and information about the answer. In case of 'error', a list with the errors. In case of 'ok' an empty list.

createNode(self, node, server=None, type='leaf', parent=None, access=None)

source code 

Creates a node with the specified parameters.

Parameters:
  • node (string) - The ID of the node to create
  • server (string) - PubSub server
  • type (string) - Type of the node: 'leaf' or 'collection'
  • parent (string) - id of the parent node. None if parent is root
  • acccess - Access model of the node
  • access (string)
Returns: (string , list[string])
A tuple with the type of answer ('ok','error') and information about the answer. In case of 'error', a list with the errors. In case of 'ok' the name of the created node.

createInstantNode(self, server=None, type='leaf', parent=None, access=None)

source code 

Creates an instant node without a name. The server will generate id.

deleteNode(self, node, server=None)

source code 

Deletes the selected node.

Parameters:
  • node (string) - id of the node to delete
  • server (string) - PubSub server
Returns: (string , list[string])
A tuple with the type of answer ('ok','error') and information about the answer. In case of 'error', a list with the errors. In case of 'ok' an empty list.