Session timeout when WebSockets are enabled
To reproduce the problem:
- add <session-config><session-timeout>5</session-timeout></session-config> in web.xml (non required, but the default timeout is 30 minutes, so you have to wait only 5 minutes before session timeout)
- start Tomcat
- open your browser and go to http://localhost:8080/jwt-hello: the application starts and works properly
- wait 5 minutes - I checked with Chrome developer tools and every 50 seconds a ping message is sent on the web socket
In Tomcat log shows up: INFO eu.webtoolkit.jwt.WtServlet - Session exiting: B3796147971B76E8C8FC6D68D8D181B0 (#sessions = 0)
then every 50 seconds: http-nio-8080-exec-7] INFO eu.webtoolkit.jwt.WebSocketSupport - WebSocket message discarded: could not retrieve web session
if I try to use the application the loading indicator appers in the top right corner but nothing happens.
Am I missing something or is it a bug?
I think we're still missing a keep-alive mechanism for JWt when WebSockets are being used. We can't use WebSocket traffic to keep a session alive, but we'll still need to send HTTP messages from time to time just for that.