You cannot process ping messages. The JSR 356 specification (Java API for WebSocket) indicates that the implementation should always respond to ping, without giving the application any opportunity to interact with these requests.
You can send pings and consume pong only:
@OnMessage
public void onPong(PongMessage pongMessage) {
}
Why do you want to do this?
source
share