Presence Stanza#

class slixmpp.stanza.Presence(*args, recv=False, **kwargs)[source]#

XMPP’s <presence> stanza allows entities to know the status of other clients and components. Since it is currently the only multi-cast stanza in XMPP, many extensions add more information to <presence> stanzas to broadcast to every entry in the roster, such as capabilities, music choices, or locations (XEP-0115: Entity Capabilities and XEP-0163: Personal Eventing Protocol).

Since <presence> stanzas are broadcast when an XMPP entity changes its status, the bulk of the traffic in an XMPP network will be from <presence> stanzas. Therefore, do not include more information than necessary in a status message or within a <presence> stanza in order to help keep the network running smoothly.

Example <presence> stanzas:

<presence />

<presence from="">
  <status>Getting lunch.</status>

<presence type="unavailable" />

<presence to="" type="subscribe" />
Stanza Interface:
  • priority: A value used by servers to determine message routing.

  • show: The type of status, such as away or available for chat.

  • status: Custom, human readable status message.

  • types: One of: available, unavailable, error, probe, subscribe, subscribed, unsubscribe, and unsubscribed.

  • showtypes: One of: away, chat, dnd, and xa.


Remove both the type attribute and the <show> element.


Return the value of the <presence> element as an integer.

Return type



Return the value of the <presence> stanza’s type attribute, or the value of the <show> element if valid.

Return type



Create a new reply <presence/> stanza from self.

Overrides StanzaBase.reply.


clear (bool) – Indicates if the stanza contents should be removed before replying. Defaults to True.


Set the entity’s priority value. Some server use priority to determine message routing behavior.

Bot clients should typically use a priority of 0 if the same JID is used elsewhere by a human-interacting client.


value (int) – An integer value greater than or equal to 0.


Set the value of the <show> element.


show (str) – Must be one of: away, chat, dnd, or xa.


Set the type attribute’s value, and the <show> element if applicable.


value (str) – Must be in either self.types or self.showtypes.