title: Close the Websocket connection using STOMP
body: <p>Currently, I have a project with Websocket and Stomp as the sub-protocol for messaging, I need to manage the disconnection event and reconnection event on the Websocket. <strong>My ultimate goal is to close the WebSocket session with STOMP after 5 seconds if there is no message between server and client</strong>. I am quite confused about heart-beat values when set in server and client. For example, I have these heart-beat values set in the client (using <code>Stomp.js</code>):</p>
  <pre class="lang-js prettyprint-override"><code>stompClient.heartbeat.outgoing = 5000;
  stompClient.heartbeat.incoming = 1000;
  </code></pre>
  <p>And here is what I have for the heart-beat values on the server-side (Spring Boot):</p>
  <pre class="lang-java prettyprint-override"><code>config.enableSimpleBroker(&quot;/topic&quot;)
                  .setTaskScheduler(taskScheduler()).setHeartbeatValue(new long[]{5000, 5000});
  </code></pre>
  <p>So I set the value on the server-side it will send a PONG message every 5 seconds, but on the client-side, it expects to receive the message in 1s, but when it waits for more than one second, the connection is still there and the WebSocket is still working.</p>
  <p>And if I change one of the values on one side and how it affects the other side? And how I can assert that the connection will be closed in the <strong>specific time</strong> with these heart-beat values? Thanks very much.</p>