title: API gateway for WebSocket
body: <p>I need a API gateway for my websocket application.</p>
  
  <ol>
  <li>Analyse and identify unusual requests from certain IP</li>
  <li>Quotas and Rate Limiting</li>
  <li>Statistics</li>
  <li>Free or commercial</li>
  <li>Solid performance</li>
  </ol>
  
  <p>The sub-protocol of my WebSocket is WAMP, so I am afraid there is no existing product to do the job.</p>
  
  <p>I intend to develop one and suppose it will work in this way:</p>
  
  <p><img src="https://i.stack.imgur.com/EWicw.jpg" alt="enter image description here"></p>
  
  <ul>
  <li>There is a proxy (NGINX or HAProxy) installed between my client application and my websocket server</li>
  <li>The proxy duplicates the request/response to another app, which I call <code>monitor</code></li>
  <li>The <code>monitor</code> app analyses the flow and control the proxy to limit/block certain ip.</li>
  <li>The <code>monitor</code> app run alongside and if it is down, it does not affect my application and the proxy.</li>
  </ul>
  
  <p>This approach sounds feasible. But the proxy seems not support reusing upstream connection to the <code>monitor</code>.</p>
  
  <p>Suppose there are 10K connections established from proxy to clients, then proxy also establishes 10K connections as upstream to <code>monitor</code> app? that is unacceptable.</p>
  
  <p>I expect only one or several connections are established between proxy and <code>monitor</code> to send the duplicate requests/responses. Certainly the proxy informs <code>monitor</code> the real source/target for each request / response.</p>
  
  <p>Is there any proxy or product satisfying this requirement so that I only need develop less?</p>