use of com.tvd12.ezyfoxserver.client.request.EzyPingRequest in project ezyfox-server by youngmonkeys.
the class EzyPingController method handle.
@Override
public void handle(EzyServerContext ctx, EzyPingRequest request) {
EzyResponse response = EzyPongResponse.getInstance();
EzySession session = request.getSession();
ctx.send(response, session, false);
}
use of com.tvd12.ezyfoxserver.client.request.EzyPingRequest in project ezyfox-server-android-client by youngmonkeys.
the class EzyPingSchedule method sendPingRequest.
private void sendPingRequest() {
int lostPingCount = pingManager.increaseLostPingCount();
int maxLostPingCount = pingManager.getMaxLostPingCount();
if (lostPingCount >= maxLostPingCount) {
client.getSocket().disconnect(EzyDisconnectReason.SERVER_NOT_RESPONDING.getId());
} else {
EzyRequest request = new EzyPingRequest();
client.send(request);
}
if (lostPingCount > 1) {
EzyLogger.info("lost ping count: " + lostPingCount);
EzyLostPingEvent event = new EzyLostPingEvent(lostPingCount);
socketEventQueue.addEvent(event);
}
}
Aggregations