The Web container clears the HttpSession property from HttpSession when the HttpSession is aborted (through a display failure or timeout).
1 Public Interface Httpsessionbindinglistener {2 Public void Valueunbound (httpsessionbindingevent hsbe); 3 Public void Valuebound (httpsessionbindingevent hsbe); 4 }
Javax.servlet.http.HttpSessionBindingListener
When the page is opened by opening an event to access the server endpoint, when an object that implements the Httpsessionbindinglistener interface is added to the property, the WebSocket endpoint instance can be notified by this method when HttpSession fails. Gives a chance to close the WebSocket connection, guaranteeing a strong correlation between the HttpSession and WebSocket session.
Resources
"Java websocket Programming" p224-225
WebSocket HttpSession and WebSocket Session Association