ComponentXMPP

class sleekxmpp.componentxmpp.ComponentXMPP(jid, secret, host=None, port=None, plugin_config=None, plugin_whitelist=None, use_jc_ns=False)[source]

SleekXMPP’s basic XMPP server component.

Use only for good, not for evil.

Parameters:
  • jid – The JID of the component.

  • secret – The secret or password for the component.

  • host – The server accepting the component.

  • port – The port used to connect to the server.

  • plugin_config – A dictionary of plugin configurations.

  • plugin_whitelist – A list of approved plugins that will be loaded when calling register_plugins().

  • use_jc_ns – Indicates if the 'jabber:client' namespace should be used instead of the standard 'jabber:component:accept' namespace. Defaults to False.

connect(host=None, port=None, use_ssl=False, use_tls=False, reattempt=True)[source]

Connect to the server.

Setting reattempt to True will cause connection attempts to be made every second until a successful connection is established.

Parameters:
  • host – The name of the desired server for the connection. Defaults to server_host.

  • port – Port to connect to on the server. Defauts to server_port.

  • use_ssl – Flag indicating if SSL should be used by connecting directly to a port using SSL.

  • use_tls – Flag indicating if TLS should be used, allowing for connecting to a port without using SSL immediately and later upgrading the connection.

  • reattempt – Flag indicating if the socket should reconnect after disconnections.

incoming_filter(xml)[source]

Pre-process incoming XML stanzas by converting any 'jabber:client' namespaced elements to the component’s default namespace.

Parameters:

xml – The XML stanza to pre-process.

start_stream_handler(xml)[source]

Once the streams are established, attempt to handshake with the server to be accepted as a component.

Parameters:

xml – The incoming stream’s root element.