title: Spring 4 + Websockets: how to close the session?
body: <p>I am using Spring 4 + Websockets + Stomp JS library.
  I could not find any way to setup websocket ping/pong mechanism (heartbeat).</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" ..."&gt;
  
  &lt;websocket:message-broker&gt;
      &lt;websocket:stomp-endpoint path="/cors/auth/clientEndpoint"&gt;
          &lt;websocket:handshake-handler ref="myHandshakeHandler" /&gt;
      &lt;/websocket:stomp-endpoint&gt;
      &lt;websocket:simple-broker prefix="/queue, /topic" /&gt;
      &lt;websocket:client-inbound-channel&gt;
          &lt;websocket:interceptors&gt;
              &lt;bean class="com.mycompany.myproject.utils.messaging.MyInboundChannelInterception"&gt;&lt;/bean&gt;
          &lt;/websocket:interceptors&gt;
      &lt;/websocket:client-inbound-channel&gt;
  &lt;/websocket:message-broker&gt;
  
  &lt;bean id="myHandshakeHandler" class="com.mycompany.myproject.utils.security.MyHandshakeHandler" /&gt;
  
  &lt;bean class="org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean"&gt;
      &lt;property name="maxSessionIdleTimeout" value="120000" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>
  
  <p>As result, I am implementing my own mechanism of ping/pong messages.</p>
  
  <p>One of the tasks here - to implement server side closure of the websocket in case if no ping message during more than 10s from client.</p>
  
  <p>And no way to do this using Spring Websockets!</p>
  
  <p>Maybe somebody can tell me how to access Session object of the user or to close those Session via Spring Websockets? </p>
  
  <p>Seems Spring is very limited here.</p>