How can I get time for which the client is connected to a socket?
There is no such feature.
I'd suggest creating @OnOpen
method, which will save the time to current instance (Endpoints are by default WebSocket Session scoped) and work with that value.
Feel free to file an enhancement against Tyrus.