I am using Spring MVC for handling users' requests. Each user has its own 'storage' hidden behind session scoped component. The problem I am trying to solve right now is how to serve those session scoped data to correct users while communicating over WebSockets (SockJS + Stomp). I was thinking about changing the session scoped storage to a singleton one which will hold a map with session id as a key. Then I will be able to look up for the correct storage based on session id.
But I don't like that hacky solution. I feel like I will break the whole purpose of session scoped components. Is there any other way how to serve users' data while communicating over websockets?
Thank you for your suggestions.
The very same problem is here: stackoverflow, but no relevant suggestion was provided.