title: Add header on WebSocket handshake with modifyHandshake
body: <p>I'm trying to send a custom header during the handshake. I can intercept the handshake with the ServerEndpointConfig.Configurator and override modifyHandshake.</p>
  
  <pre><code>public class WebsocketConfigurator extends ServerEndpointConfig.Configurator {
  
      public static final String HEADER_SOCKET_ID = "X-Socket-Id";
  
      @Override
      public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
          String id = UUID.randomUUID().toString();
  
          List&lt;String&gt; list = new ArrayList&lt;String&gt;();
              list.add(id);
              response.getHeaders().put(HEADER_SOCKET_ID, list);
  
          sec.getUserProperties().put(HEADER_SOCKET_ID, id);  }
  
  
  
  }
  </code></pre>
  
  <p>The method gets called and the id gets added to the response headers, though it doesn't send the additional headers. </p>
  
  <p>I sniffed it with wireshark to make sure it's not the client framework:</p>
  
  <pre><code>GET /websocket HTTP/1.1
  Upgrade: websocket
  Connection: Upgrade
  Host: localhost:8080
  Origin: http://localhost:8080
  Pragma: no-cache
  Cache-Control: no-cache
  Sec-WebSocket-Key: QgZwJwVv8+i/vaKFHDqPZg==
  Sec-WebSocket-Version: 13
  Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits, x-webkit-deflate-frame
  User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1941.0 Safari/537.36
  
  HTTP/1.1 101 Switching Protocols
  Upgrade: WebSocket
  Connection: Upgrade
  Sec-WebSocket-Accept: Kim6Qjj7sOBLfG+6I++gS/OVx4A=
  Sec-WebSocket-Extensions: permessage-deflate
  
  .u.....0....y.R...K'6...9M
  .....PU.......}..).B..g.P....D..4."!..R|._.@..Fp..G....c..0...].D...F.H...{E-.k{.pP...S{n...
  </code></pre>
  
  <p>I want to send a generated id to the client and don't want to do it in an extra call. Is there a reason why it's not sent or is there a different approach?</p>
  
  <p>I found an example on the <a href="https://blogs.oracle.com/PavelBucek/entry/tyrus_1_0_b12_released" rel="nofollow">dev blog</a> which also adds a header in <code>modifyHandshake</code> so I guess theoretically it should be possible.</p>