title: Node.js running an http server and web socket server concurrently
body: <p>I have been trying to implement an HTTP server which receives POST requests from a particular computer. The HTTP server will then extract the message body received and send the body's data to another client, using web sockets.</p>
  
  <p>The code for the HTTP server is the following:</p>
  
  <pre><code>    var http=require('http');
  
  
      var server = http.createServer(function(request, response){
          var msgbody='';
          if(request.method == "POST"){
               request.on('data', function(data){
                    msgbody=data;
  
                    //upon receiving POST request send msgbody to the client using websockets
               });
          }
      }).listen(80);
  </code></pre>
  
  <p>Could you please provide me with some insight regarding how the web sockets part can be correctly implemented alongside the running HTTP server? The HTTP server and the web socket server need to run on the same port and IP address. </p>
  
  <p>Thank you </p>