# `ping` — XMPP Ping (XEP-0199)

XMPP Ping is a ping on the XMPP protocol level. It can be used to detect connection liveness (although `aioxmpp.stream.StanzaStream` and thus `aioxmpp.Client` does that for you) and connectivity/availablility of remote domains.

## Service

class `aioxmpp.``PingService`

  Service implementing XMPP Ping (XEP-0199).

  This service implements the response to XMPP Pings and provides a method to send pings.

  coroutine `ping`(peer)

    Ping a peer.

    Parameters: | peer (`aioxmpp.JID`) – The peer to ping.
    Raises: | aioxmpp.errors.XMPPError – as received

    Send a XEP-0199 ping IQ to peer and wait for the reply.

    Note

    If the peer does not support XEP-0199, they will respond with a `cancel` `service-unavailable` error. However, some implementations return a `cancel` `feature-not-implemented` error instead. Callers should be prepared for the `aioxmpp.XMPPCancelError` exceptions in those cases.

## XSOs

Sometimes it is useful to send a ping manually instead of relying on the `Service`. For this, the `Ping` IQ payload can be used.

class `aioxmpp.ping.``Ping`

  Simple XSO to represent an XMPP ping.

  It takes no arguments and has no attributes or children.