Package pyxmpp2 :: Module client
[hide private]

Module client

Basic XMPP-IM client implementation.

The Client class provides the base for client applications.

To create an XMPP client session applications should create a Client instance providing in the constructor: a client JID, settings and handlers providing application behaviour (the list may contain a single handler object which will be 'the application). The Client class will provide some other handlers: StreamTLSHandler, StreamSASLHandler, SessionHandler, ResourceBindingHandler and RosterClient. The last one is available via the Client.roster_client attribute and should be used to manipulate the roster. The roster itself is available via the Client.roster property.

The Client object will open an XMPP stream after the Client.connect method is called. It will send the initial presence (specified by the initial_presence setting ) upon log-in and the final presence on log-out. Other presence handling, including subscriptions is the responsibility of the application.

The API is asynchronous and actual connection is made and data exchanged in the main event loop. A MainLoop object can be passed to the Client constructor, but this is not needed, as Client will create one if needed. The main loop can be started by Client.run().

To close the XMPP session use the Client.disconnect() method.

Normative reference:
Classes [hide private]
  Client
Base class for an XMPP-IM client.
Functions [hide private]
 
_move_session_handler(handlers)
Find a SessionHandler instance in the list and move it to the beginning.
 
_initial_presence_factory(settings)
Factory for the initial_presence setting default.
Variables [hide private]
  logger = logging.getLogger("pyxmpp2.client")