Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`words`.`protocols`.`jabber`.`component`.`Router``

class documentation

`class Router: (source)`

View In Hierarchy

XMPP Server's Router.

A router connects the different components of the XMPP service and routes messages between them based on the given routing table.

Connected components are trusted to have correct addressing in the stanzas they offer for routing.

A route destination of `None` adds a default route. Traffic for which no specific route exists, will be routed to this default route.

Present Since
8.2

Method | `__init__` | Undocumented
Method | `addRoute` | Add a new route.
Method | `removeRoute` | Remove a route.
Method | `route` | Route a stanza.
Instance Variable | `routes` | Routes based on the host part of JIDs. Maps host names to the `EventDispatcher`s that should receive the traffic. A key of `None` means the default route.

def __init__(self): (source)

Undocumented

def addRoute(self, destination, xs): (source)

Add a new route.

The passed XML Stream `xs` will have an observer for all stanzas added to route its outgoing traffic. In turn, traffic for `destination` will be passed to this stream.

Parameters
destination:`str` or `None`. | Destination of the route to be added as a host name or `None` for the default route.
xs:`EventDispatcher`. | XML Stream to register the route for.

def removeRoute(self, destination, xs): (source)

Remove a route.

Parameters
destination:`str`. | Destination of the route that should be removed.
xs:`EventDispatcher`. | XML Stream to remove the route for.

def route(self, stanza): (source)

Route a stanza.

Parameters
stanza:`domish.Element`. | The stanza to be routed.

routes: `dict` = (source)

Routes based on the host part of JIDs. Maps host names to the `EventDispatcher`s that should receive the traffic. A key of `None` means the default route.