Skip to content
Back to top
View this page

# ComponentXMPP

class slixmpp.componentxmpp.ComponentXMPP(jid, secret, host=None, port=None, plugin_config=None, plugin_whitelist=None, use_jc_ns=False, fix_error_ns=False)

  Slixmpp’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`.

    - fix_error_ns – Fix the namespace of error stanzas. If you use `use_jc_ns` namespace, you probably want that, but it can be a problem if you use both a ClientXMPP and a ComponentXMPP in the same interpreter. This is `False` by default for backwards compatibility.

  connect(host=None, port=None)

    Connect to the server.

    Parameters:

      - host (`str` | `None`) – The name of the desired server for the connection. Defaults to `server_host`.

      - port (`int` | `None`) – Port to connect to on the server. Defaults to `server_port`.

    Return type:

      `Future`

  incoming_filter(xml)

    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.

  is_component: Literal[True]

    The distinction between clients and components can be important, primarily for choosing how to handle the `'to'` and `'from'` JIDs of stanzas.

  start_stream_handler(xml)

    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.