Vertx provides a clustered session store and a local session store for web sessions. Vertx also provides support for web sockets via SockJS.
If you use the local session store, any web socket "PING" will extend the web session timeout. If you use the clustered session store, a different mechanism for the web session timeout is used and the mechanism to extend the timeout does not work.
- Start de.apwolf.Main#main with useClusteredSessionStore=true
- After the backend has started, perform a REST request: http://localhost:8086/test
- You will see this log line: Received REST request on /test with session someId
- Open the sockjs client
- A web socket session will start, you will see this log line every 5 seconds: Received WS request SOCKET_PING for session someId
- Wait 2 minutes (the timeout for the session)
- Perform the same REST request again: http://localhost:8086/test
→ You will see a different session id
To see that it works with the local session store, redo all the steps with useClusteredSessionStore=false
The web session timeout for a websocket ping is extended in io.vertx.ext.web.handler.sockjs.impl. EventBusBridgeImpl#internalHandlePing by calling io.vertx.ext.web.Session#setAccessed.
io.vertx.ext.web.sstore.impl.LocalSessionStoreImpl#handle checks Session#lastAccessed to evaluate whether a session was timed out, so everything works fine.
io.vertx.ext.web.sstore.impl.ClusteredSessionStoreImpl does not use Session#lastAccessed,
it uses io.vertx.core.shareddata.AsyncMap and its internal TTL mechanism.
So the timeout extension performed by the event bus bridge is not honored and the session runs out
although the websocket session is still open.