I have a real-time application with clients using websockets to connect with a Spring Framework server, which is running Spring Boot Tomcat. I want the server to quickly (wi
ServletServerContainerFactoryBean simply configures the underlying JSR-356 WebSocketContainer through Spring configuration on startup. If you peek inside you'll see it's trivial.
From what I can see in Tomcat code about the handling of maxSessionIdleTimeout, the WsWebSocketContainer#backgroundProcess() method runs every 10 seconds by default to see if there are expired sessions.
I suspect also the pings you're sending from the server are making the session appear active, hence not helping with regards to the idle session timeout configuration.
As to why Tomcat doesn't realize the client is disconnected sooner, I can't really say. In my experience if a client closes a WebSocket connection or if I kill the browser it's detected immediately. In any case that's more to do with Tomcat not Spring.