public final class PingManager extends Manager
This class implements the application-level ping mechanism as specified in XEP-0199: XMPP Ping.
If enabled, it periodically pings the server to ensure a stable connection. These pings are not sent as long as other stanzas are sent, because they serve the same purpose (telling the server, that we are still available).
For Server-To-Client Pings it automatically responds with a result (pong), if enabled.
It also allows to ping the server manually (Client-To-Server Pings) or to ping other XMPP entities (Client-to-Client Pings).
Modifier and Type | Method and Description |
---|---|
java.time.Duration |
getPingInterval()
Gets the ping interval.
|
AsyncResult<java.lang.Boolean> |
ping(Jid jid)
Pings the given XMPP entity.
|
AsyncResult<java.lang.Boolean> |
pingServer()
Pings the connected server.
|
void |
setPingInterval(java.time.Duration pingInterval)
Sets the automatic ping interval.
|
isEnabled, setEnabled
public final AsyncResult<java.lang.Boolean> ping(Jid jid)
Pings the given XMPP entity.
jid
- The JID to ping.public final AsyncResult<java.lang.Boolean> pingServer()
Pings the connected server.
public final java.time.Duration getPingInterval()
Gets the ping interval. The default ping interval is 900 seconds (15 minutes).
setPingInterval(Duration)
public final void setPingInterval(java.time.Duration pingInterval)
Sets the automatic ping interval. Any scheduled future ping is canceled and a new ping is scheduled after the specified interval.
pingInterval
- The ping interval in seconds.getPingInterval()
Copyright © 2014–2019 XMPP.rocks. All rights reserved.