Known subclasses: wokkel.client.XMPPClient, wokkel.component.Component

Business logic representing a managed XMPP connection.

This maintains a single XMPP connection and provides facilities for packet routing and transmission. Business logic modules are objects providing IXMPPHandler (like subclasses of XMPPHandler), and added using addHandler.

Instance Variable xmlstream currently managed XML stream (type: XmlStream)
Instance Variable logTraffic if true, log all traffic. (type: bool)
Instance Variable timeout Default IQ request timeout in seconds. (type: int)
Method __init__ Construct a stream manager.
Method addHandler Add protocol handler.
Method initializationFailed Called when stream initialization has failed.
Method send Send data over the XML stream.
Method request Send an IQ request and track the response.
Instance Variable _initialized Whether the stream represented by xmlstream has been initialized. This is used when caching outgoing stanzas. (type: bool)
Instance Variable _packetQueue internal buffer of unsent data. See send for details. (type: list)
Instance Variable _reactor A provider of IReactorTime to track timeouts.
Method _connected Called when the transport connection has been established.
Method _authd Called when the stream has been initialized.
Method _disconnected Called when the stream has been closed.
Method _onIQResponse Handle iq response by firing associated deferred.

Inherited from XMPPHandlerCollection:

Instance Variable handlers List of protocol handlers. (type: list of objects providing IXMPPHandler)
Method __iter__ Act as a container for handlers.
Method removeHandler Remove protocol handler.
xmlstream =
currently managed XML stream (type: XmlStream)
logTraffic =
if true, log all traffic. (type: bool)
_initialized =
Whether the stream represented by xmlstream has been initialized. This is used when caching outgoing stanzas. (type: bool)
_packetQueue =
internal buffer of unsent data. See send for details. (type: list)
timeout =
Default IQ request timeout in seconds. (type: int)
_reactor =
A provider of IReactorTime to track timeouts.
def __init__(self, factory, reactor=None): (source)

Construct a stream manager.

ParametersfactoryThe stream factory to connect with.
reactorA provider of IReactorTime to track timeouts. If not provided, the global reactor will be used.
def addHandler(self, handler): (source)

Add protocol handler.

When an XML stream has already been established, the handler's connectionInitialized will be called to get it up to speed.

def _connected(self, xs): (source)

Called when the transport connection has been established.

Here we optionally set up traffic logging (depending on logTraffic) and call each handler's makeConnection method with the XmlStream instance.

def _authd(self, xs): (source)

Called when the stream has been initialized.

Send out cached stanzas and call each handler's connectionInitialized method.

def initializationFailed(self, reason): (source)

Called when stream initialization has failed.

Stream initialization has halted, with the reason indicated by reason. It may be retried by calling the authenticator's initializeStream. See the respective authenticators for details.

ParametersreasonA failure instance indicating why stream initialization failed. (type: failure.Failure)
def _disconnected(self, reason): (source)

Called when the stream has been closed.

From this point on, the manager doesn't interact with the XmlStream anymore and notifies each handler that the connection was lost by calling its connectionLost method.

def _onIQResponse(self, iq): (source)

Handle iq response by firing associated deferred.

def send(self, obj): (source)

Send data over the XML stream.

When there is no established XML stream, the data is queued and sent out when a new XML stream has been established and initialized.

Parametersobjdata to be sent over the XML stream. See xmlstream.XmlStream.send for details.
def request(self, request): (source)

Send an IQ request and track the response.

A request is an IQ generic.Stanza of type 'get' or 'set'. It will have its toElement called to render to a Element which is then sent out over the current stream. If there is no such stream (yet), it is queued and sent whenever a connection is established and initialized, just like send.

If the request doesn't have an identifier, it will be assigned a fresh one, so the response can be tracked.

The deferred that is returned will fire with the Element representation of the response if it is a result iq. If the response is an error iq, a corresponding error.StanzaError will be errbacked.

If the connection is closed before a response was received, the deferred will be errbacked with the reason failure.

A request may also have a timeout, either by setting a default timeout in StreamManager's timeout attribute or on the timeout attribute of the request.

ParametersrequestThe IQ request. (type: generic.Request)
API Documentation for wokkel, generated by pydoctor at 2018-12-06 14:45:46.