Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] @WebSocket methods Stateful vs stateless


If we take the stateless approach where the session is passed into even On<Method> call, we probably
Need to store the session object as key in a HashMap to look up any related data when when events such
Close happen or to say deliver the message received to consumers.

Is it safe to use the session object as a key to a Map ?. Looking at WebSocketSession’s implementation of equals and hashcode, I am
Thinking yes. But it seems like I would be relying on implementation detail.

The other option is to stay stateful where the session can be closely associated with relevant data from application domain that
Can be used for lookups.

Please let me know which option is recommended.


This e-mail and any attached files are intended solely for the use of the individual or entity to which this mail is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Any use, disclosure, copying or distribution of this e-mail or the attached files by anyone other than the intended recipient is strictly prohibited. If you have received this e-mail in error, please notify the sender by reply e-mail or collect call to (650) 388-4111 and delete this e-mail and attached files from your system. Thank you.

Back to the top