As per the documentation here https://www.rfc-editor.org/rfc/rfc6455#page-37,
a websocket
must respond to a ping
request with pong
.
I have implemented spring boot websocket
to handle the websocket
connections from clients.
I have a websocket
client implemented which sends ping frames
periodically.
I found it here https://stackoverflow.com/a/24438328 that I cannot process ping messages in java.
I have queries regarding this -
ping
requests in java spring-boot websocket
?ping
request with pong
?Extend class TextWebSocketHandler
and write your logic in handleTextMessage
method. If you are looking for more generic approach look into WebSocketHandler
interface. But as Antoniossss suggested ping pong is already implemented on protocol level for checking if connection is still alive.