Package xmpp :: Module client :: Class CommonClient

[hide private]
[frames] | no frames]

# Class CommonClient

source code

Known Subclasses:
  Client, Component

Base for Client and Component classes.

Instance Methods | [hide private]

__init__(self, server, port=5222, debug=`[``'``always``'``,` `'``nodebuilder``'``]`) Caches server name and (optionally) port to connect to. | source code

RegisterDisconnectHandler(self, handler) Register handler that will be called on disconnect. | source code

UnregisterDisconnectHandler(self, handler) Unregister handler that is called on disconnect. | source code

disconnected(self) Called on disconnection. | source code

DisconnectHandler(self) Default disconnect handler. | source code

event(self, eventName, args=`{``}`) Default event handler. | source code

isConnected(self) Returns connection state. | source code

reconnectAndReauth(self) Example of reconnection method. | source code

connect(self, server=None, proxy=None, ssl=None, use_srv=None) Make a tcp/ip connection, protect it with tls/ssl if possible and start XMPP stream. | source code

Method Details | [hide private]

### __init__(self, server, port=5222, debug=`[``'``always``'``,` `'``nodebuilder``'``]`)
(Constructor)

source code

    Caches server name and (optionally) port to connect to. "debug" parameter specifies
    the debug IDs that will go into debug output. You can either specifiy an "include"
    or "exclude" list. The latter is done via adding "always" pseudo-ID to the list.
    Full list: ['nodebuilder', 'dispatcher', 'gen_auth', 'SASL_auth', 'bind', 'socket',
     'CONNECTproxy', 'TLS', 'roster', 'browser', 'ibb'] .

### disconnected(self)

source code

Called on disconnection. Calls disconnect handlers and cleans things up.

### DisconnectHandler(self)

source code

Default disconnect handler. Just raises an IOError. If you choosed to use this class in your production client, override this method or at least unregister it.

### event(self, eventName, args=`{``}`)

source code

Default event handler. To be overriden.

### isConnected(self)

source code

Returns connection state. F.e.: None / 'tls' / 'tcp+non_sasl' .

### reconnectAndReauth(self)

source code

Example of reconnection method. In fact, it can be used to batch connection and auth as well.

### connect(self, server=None, proxy=None, ssl=None, use_srv=None)

source code

Make a tcp/ip connection, protect it with tls/ssl if possible and start XMPP stream. Returns None or 'tcp' or 'tls', depending on the result.