src/main/java/org/java_websocket/AbstractWebSocket.java
private void executeConnectionLostDetection(WebSocket webSocket, long minimumPongTime) {
		if (!(webSocket instanceof WebSocketImpl)) {
			return;
		}
		WebSocketImpl webSocketImpl = (WebSocketImpl) webSocket;
		if( webSocketImpl.getLastPong() < minimumPongTime ) {
			log.trace("Closing connection due to no pong received: {}", webSocketImpl);
			webSocketImpl.closeConnection( CloseFrame.ABNORMAL_CLOSE, "The connection was closed because the other endpoint did not respond with a pong in time. For more information check: https://github.com/TooTallNate/Java-WebSocket/wiki/Lost-connection-detection" );
		} else {
			if( webSocketImpl.isOpen() ) {
				webSocketImpl.sendPing();
			} else {
				log.trace("Trying to ping a non open connection: {}", webSocketImpl);
			}
		}
	}
private void executeConnectionLostDetection(WebSocket webSocket, long minimumPongTime) {
		if (!(webSocket instanceof WebSocketImpl)) {
			return;
		}
		WebSocketImpl webSocketImpl = (WebSocketImpl) webSocket;
		if( webSocketImpl.getLastPong() < minimumPongTime ) {
			log.trace("Closing connection due to no pong received: {}", webSocketImpl);
			webSocketImpl.closeConnection( CloseFrame.ABNORMAL_CLOSE, "The connection was closed because the other endpoint did not respond with a pong in time. For more information check: https://github.com/TooTallNate/Java-WebSocket/wiki/Lost-connection-detection" );
		} else {
			if( webSocketImpl.isOpen() ) {
				webSocketImpl.sendPing();
			} else {
				log.trace("Trying to ping a non open connection: {}", webSocketImpl);
			}
		}
	}
private void executeConnectionLostDetection ( WebSocket webSocket , long minimumPongTime ) { if ( ! ( webSocket instanceof WebSocketImpl ) ) { return ; } WebSocketImpl webSocketImpl = ( WebSocketImpl ) webSocket ; if ( webSocketImpl . getLastPong ( ) < minimumPongTime ) { log . trace ( "Closing connection due to no pong received: {}" , webSocketImpl ) ; webSocketImpl . closeConnection ( CloseFrame . ABNORMAL_CLOSE , "The connection was closed because the other endpoint did not respond with a pong in time. For more information check: https://github.com/TooTallNate/Java-WebSocket/wiki/Lost-connection-detection" ) ; } else { if ( webSocketImpl . isOpen ( ) ) { webSocketImpl . sendPing ( ) ; } else { log . trace ( "Trying to ping a non open connection: {}" , webSocketImpl ) ; } } }
Send a ping to the endpoint or close the connection since the other endpoint did not respond with a ping
@param webSocket the websocket instance
@param minimumPongTime the lowest/oldest allowable last pong time (in nanoTime) before we consider the connection to be lost
Send a ping to the endpoint or close the connection since the other endpoint did not respond with a ping