Why is XMPPConnection not Serializable?

Hello,
I’m building a web-based chat over Websockets and using Smack to connect to Openfire.
At the moment i’m using a HashMap on the server to store the relationship between websocket sessionId and XMPPConnection. This way I know when a request comes I know which XMPP connection belongs to.
However, this solution does not scale horizontally. If I add more servers then each one of them holds in their memory a separate Map with different connections.
For this reason I was thinking to store the relationship in a key value store like Redis or Hazelcast. Then from my code I would be able to call redis.get(websocketSession.getSessionId()) and receive the XMPPConnection to work with. However this is not possible because XMPPConnection is not serializable.
How can I achieve this?

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.