title: boost beast websocket connection close handler
body: <p>I am new to boost and i am trying to write a simple chat application for websocket. For reference i'm using the <a href="https://www.boost.org/doc/libs/1_66_0/libs/beast/doc/html/beast/examples.html#beast.examples.servers" rel="nofollow noreferrer">websocket-server-sync</a> example from the website.</p>
  
  <p>I made a global vector that stores websocket::streams, and in the do_session method after creating the websocket i push it in the vector.</p>
  
  <pre><code>std::vector&lt;websocket::stream&lt;tcp::socket&gt;*&gt; socket_streams;
  </code></pre>
  
  <p>Everytime i read a message i send it to everyone from this vector, so its working well so far. However when someone closes the connection (even when its not properly closed, e.g. the internet connection goes down) i want to remove the stream object from my vector. I tried to look in the beast headers for a "close handler" or something like that, but i couldn't find anything. Is there a way to do this? Like:</p>
  
  <pre><code>void close_handler(websocket::stream&lt;tcp::socket&gt;* _stream) 
  {
     //remove _stream from socket_streams
  }
  </code></pre>