title: how to do a proxy for a websocket in Node
body: <p>In Node I was able to do a <code>http</code> proxy in the following way:</p>
  
  <pre><code>https://localhost:443 -&gt; http://localhost:8100
  </code></pre>
  
  <p>with the following code:</p>
  
  <pre><code>var express = require('express');
  var app = express();
  var https = require('https');
  var httpProxy = require('http-proxy');
  ...
  app.use(function (req, res, next) {
      httpProxy.createServer({
          target: {
              host: 'localhost',
              port: 8100,
          }
      }).web(req, res);
  });
  ...
  https.createServer(sslOptions, app).listen(443, function(){
      console.log('App running on port: 443');
  });
  </code></pre>
  
  <p>But I also need to do a similar redirection for a web socket in the following way:</p>
  
  <pre><code>wss://localhost:8107 -&gt; ws://localhost:8100
  </code></pre>
  
  <p>Do you have any idea on how can I achieve this?</p>
  
  <p>Thanks!</p>