Unfortunately, there's no easy solution. Here's a issue about it on Play's github. Specifically, it's not possible for Play to infer that the connection is lost by itself.
Until Play supports read/idle timeouts, you can implement them yourself. Our browser extension keeps a persistent websocket connection, and we run application-level pings every x seconds. Both the client and server can initiate a disconnect if the line has been quiet for too long.
I'm not as familiar with the Java websocket API, but abstractly, you just want to keep a record of the last communication time on the server, and have a thread / actor / scheduled task clean up old connections. Then, to keep the connection alive, run pings down the socket. We initiate pings on the client (but on the server works as well), and if the server does not pong within 2 seconds, the client disconnects and reconnects.