I am trying to send PongMessage to a server from web-socket client (heart-beat message you may say).
In server, I have written a method like this inside a class Annotated with @ServerEndpoint :
@OnMessage
        public void onPong(PongMessage pongMessage, Session session) {
          LOGGER.log(Level.INFO, " -- Got Hit Yaay!! -- ");
                try {
                    session.getBasicRemote().sendText(PONG_RECEIVED);
                } catch (IOException e) {
                    e.printStackTrace();
                }
        }
PongMessage Accepts ByteBuffer according to an oracle documentation. I tried generating a bytebuffer in server and sending exact same generated bytebuffer value from socket client. Server still throws an exception saying it Cannot decode a string.
I am not able to hit onPong() method. Is there any format for pongmessage that client can send to a websocket server so that onPong() method gets invoked?  What am I doing wrong here? Any Ideas ?