Implements interfaces: wokkel.iwokkel.IDisco, wokkel.iwokkel.IPubSubService

Protocol implementation for a XMPP Publish Subscribe Service.

The word Service here is used as taken from the Publish Subscribe specification. It is the party responsible for keeping nodes and their subscriptions, and sending out notifications.

Methods from the IPubSubService interface that are called as a result of an XMPP request may raise exceptions. Alternatively the deferred returned by these methods may have their errback called. These are handled as follows:

  • If the exception is an instance of error.StanzaError, an error response iq is returned.
  • Any other exception is reported using log.msg. An error response with the condition internal-server-error is returned.

The default implementation of said methods raises an Unsupported exception and are meant to be overridden.

Instance Variable discoIdentity Service discovery identity as a dictionary with keys 'category', 'type' and 'name'.
Instance Variable pubSubFeatures List of supported publish-subscribe features for service discovery, as str. (type: list or None)
Method __init__ Undocumented
Method connectionMade Called after a connection has been established.
Method getDiscoInfo Get identity and features from this entity, node.
Method getDiscoItems Get contained items for this entity, node.
Method notifyPublish Send out notifications for a publish event.
Method notifyDelete Send out node deletion notifications.
Method getNodeInfo Undocumented
Method getNodes Undocumented
Method publish Called when a publish request has been received.
Method subscribe Called when a subscribe request has been received.
Method unsubscribe Called when a subscribe request has been received.
Method subscriptions Called when a subscriptions retrieval request has been received.
Method affiliations Called when a affiliations retrieval request has been received.
Method create Called when a node creation request has been received.
Method getConfigurationOptions Retrieve all known node configuration options.
Method getDefaultConfiguration Called when a default node configuration request has been received.
Method getConfiguration Called when a node configuration retrieval request has been received.
Method setConfiguration Called when a node configuration change request has been received.
Method items Called when a items retrieval request has been received.
Method retract Called when a item retraction request has been received.
Method purge Called when a node purge request has been received.
Method delete Called when a node deletion request has been received.
Method _onPubSubRequest Undocumented
Method _toResponse_subscribe Undocumented
Method _toResponse_subscriptions Undocumented
Method _toResponse_affiliations Undocumented
Method _toResponse_create Undocumented
Method _formFromConfiguration Undocumented
Method _checkConfiguration Undocumented
Method _preProcess_create Undocumented
Method _preProcess_default Undocumented
Method _toResponse_default Undocumented
Method _toResponse_configureGet Undocumented
Method _preProcess_configureSet Undocumented
Method _toResponse_items Undocumented
Method _createNotification Undocumented
Method _toResponse_affiliationsGet Undocumented

Inherited from XMPPHandler:

Method setHandlerParent Set the parent of the handler.
Method disownHandlerParent Remove the parent of the handler.
Method makeConnection A connection over the underlying transport of the XML stream has been established.
Method connectionInitialized The XML stream has been initialized.
Method connectionLost The XML stream has been closed.
Method send Send data over the managed XML stream.
Method request Send an IQ request and track the response.

Inherited from IQHandlerMixin:

Class Variable iqHandlers Mapping from XPath queries (as a string) to the method name that will handle requests that match the query. (type: dict)
Method handleRequest Find a handler and wrap the call for sending a response stanza.
discoIdentity =
Service discovery identity as a dictionary with keys 'category', 'type' and 'name'.
pubSubFeatures =
List of supported publish-subscribe features for service discovery, as str. (type: list or None)
def __init__(self, resource=None): (source)
def connectionMade(self): (source)

Called after a connection has been established.

Can be overridden to perform work before stream initialization.

def getDiscoInfo(self, requestor, target, nodeIdentifier=''): (source)

Get identity and features from this entity, node.

ParametersrequestorThe entity the request originated from. (type: JID)
targetThe target entity to which the request is made. (type: JID)
nodeIdentifierThe optional identifier of the node at this entity to retrieve the identify and features of. The default is '', meaning the root node. (type: unicode)
def getDiscoItems(self, requestor, target, nodeIdentifier=''): (source)

Get contained items for this entity, node.

ParametersrequestorThe entity the request originated from. (type: JID)
targetThe target entity to which the request is made. (type: JID)
nodeIdentifierThe optional identifier of the node at this entity to retrieve the identify and features of. The default is '', meaning the root node. (type: unicode)
def _onPubSubRequest(self, iq): (source)
Undocumented
def _toResponse_subscribe(self, result, resource, request): (source)
Undocumented
def _toResponse_subscriptions(self, result, resource, request): (source)
Undocumented
def _toResponse_affiliations(self, result, resource, request): (source)
Undocumented
def _toResponse_create(self, result, resource, request): (source)
Undocumented
def _formFromConfiguration(self, resource, values): (source)
Undocumented
def _checkConfiguration(self, resource, form): (source)
Undocumented
def _preProcess_create(self, resource, request): (source)
Undocumented
def _preProcess_default(self, resource, request): (source)
Undocumented
def _toResponse_default(self, options, resource, request): (source)
Undocumented
def _toResponse_configureGet(self, options, resource, request): (source)
Undocumented
def _preProcess_configureSet(self, resource, request): (source)
Undocumented
def _toResponse_items(self, result, resource, request): (source)
Undocumented
def _createNotification(self, eventType, service, nodeIdentifier, subscriber, subscriptions=None): (source)
Undocumented
def _toResponse_affiliationsGet(self, result, resource, request): (source)
Undocumented
def notifyPublish(self, service, nodeIdentifier, notifications): (source)

Send out notifications for a publish event.

ParametersserviceThe entity the notifications will originate from. (type: JID)
nodeIdentifierThe identifier of the node that was published to. (type: unicode)
notificationsThe notifications as tuples of subscriber, the list of subscriptions and the list of items to be notified. (type: list of (JID, list of Subscription, list of Element))
def notifyDelete(self, service, nodeIdentifier, subscribers, redirectURI=None): (source)

Send out node deletion notifications.

ParametersserviceThe entity the notifications will originate from. (type: JID)
nodeIdentifierThe identifier of the node that was deleted. (type: unicode)
subscribersThe subscribers for which a notification should be sent out. (type: list of JID)
redirectURIOptional XMPP URI of another node that subscribers are redirected to. (type: str)
def getNodeInfo(self, requestor, service, nodeIdentifier): (source)
Undocumented
def getNodes(self, requestor, service): (source)
Undocumented
def publish(self, requestor, service, nodeIdentifier, items): (source)

Called when a publish request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
nodeIdentifierThe identifier of the node to publish to. (type: unicode)
itemsThe items to be published as elements. (type: list of Element<twisted.words.xish.domish.Element>)
Returnsdeferred that fires on success. (type: Deferred)
def subscribe(self, requestor, service, nodeIdentifier, subscriber): (source)

Called when a subscribe request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
nodeIdentifierThe identifier of the node to subscribe to. (type: unicode)
subscriberThe entity to be subscribed. (type: JID)
ReturnsA deferred that fires with a Subscription. (type: Deferred)
def unsubscribe(self, requestor, service, nodeIdentifier, subscriber): (source)

Called when a subscribe request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
nodeIdentifierThe identifier of the node to unsubscribe from. (type: unicode)
subscriberThe entity to be unsubscribed. (type: JID)
ReturnsA deferred that fires with None when unsubscription has succeeded. (type: Deferred)
def subscriptions(self, requestor, service): (source)

Called when a subscriptions retrieval request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
ReturnsA deferred that fires with a list of subscriptions as Subscription. (type: Deferred)
def affiliations(self, requestor, service): (source)

Called when a affiliations retrieval request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
ReturnsA deferred that fires with a list of affiliations as tuples of (node identifier as unicode, affiliation state as str). The affiliation can be 'owner', 'publisher', or 'outcast'. (type: Deferred)
def create(self, requestor, service, nodeIdentifier): (source)

Called when a node creation request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
nodeIdentifierThe suggestion for the identifier of the node to be created. If the request did not include a suggestion for the node identifier, the value is None. (type: unicode or NoneType)
ReturnsA deferred that fires with a unicode that represents the identifier of the new node. (type: Deferred)
def getConfigurationOptions(self): (source)

Retrieve all known node configuration options.

The returned dictionary holds the possible node configuration options by option name. The value of each entry represents the specifics for that option in a dictionary:

  • 'type' (str): The option's type (see Field's doc string for possible values).
  • 'label' (unicode): A human readable label for this option.
  • 'options' (dict): Optional list of possible values for this option.

Example:

   {
   "pubsub#persist_items":
       {"type": "boolean",
        "label": "Persist items to storage"},
   "pubsub#deliver_payloads":
       {"type": "boolean",
        "label": "Deliver payloads with event notifications"},
   "pubsub#send_last_published_item":
       {"type": "list-single",
        "label": "When to send the last published item",
        "options": {
            "never": "Never",
            "on_sub": "When a new subscription is processed"}
       }
   }
Returns (type: dict.)
def getDefaultConfiguration(self, requestor, service, nodeType): (source)

Called when a default node configuration request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
nodeTypeThe type of node for which the configuration is retrieved, 'leaf' or 'collection'. (type: str)
ReturnsA deferred that fires with a dict representing the default node configuration. Keys are strs that represent the field name. Values can be of types unicode, int or bool. (type: Deferred)
def getConfiguration(self, requestor, service, nodeIdentifier): (source)

Called when a node configuration retrieval request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
nodeIdentifierThe identifier of the node to retrieve the configuration from. (type: unicode)
ReturnsA deferred that fires with a dict representing the node configuration. Keys are strs that represent the field name. Values can be of types unicode, int or bool. (type: Deferred)
def setConfiguration(self, requestor, service, nodeIdentifier, options): (source)

Called when a node configuration change request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
nodeIdentifierThe identifier of the node to change the configuration of. (type: unicode)
ReturnsA deferred that fires with None when the node's configuration has been changed. (type: Deferred)
def items(self, requestor, service, nodeIdentifier, maxItems, itemIdentifiers): (source)

Called when a items retrieval request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
nodeIdentifierThe identifier of the node to retrieve items from. (type: unicode)
def retract(self, requestor, service, nodeIdentifier, itemIdentifiers): (source)

Called when a item retraction request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
nodeIdentifierThe identifier of the node to retract items from. (type: unicode)
def purge(self, requestor, service, nodeIdentifier): (source)

Called when a node purge request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
nodeIdentifierThe identifier of the node to be purged. (type: unicode)
def delete(self, requestor, service, nodeIdentifier): (source)

Called when a node deletion request has been received.

ParametersrequestorThe entity the request originated from. (type: JID)
serviceThe entity the request was addressed to. (type: JID)
nodeIdentifierThe identifier of the node to be delete. (type: unicode)
API Documentation for wokkel, generated by pydoctor at 2018-12-06 14:45:46.