title: How can you make an HTTP GET request OVER a socket using NodeJS?
body: <p>I'm working with a hardware device (I did not create) that has a standard way to communicate with it over a socket connection. The device initiates the socket connection by contacted my server(NodeJS server in question).</p>
  
  <p>I have been successful in setting up a socket connection with...</p>
  
  <pre><code>var socketServer = net.createServer()
  .listen(9999, function(){
          console.log('SOCKET Listening at: http://localhost:9999');
  });
  
  socketServer.on('connection', function(sock) {
      console.log('CONNECTED: ' + sock.remoteAddress +':'+ sock.remotePort);
      console.log(sock);
      // Need to fire HTTP GET HERE
  });
  </code></pre>
  
  <p>However, I now need to send a HTTP GET request over that socket connection. So far the only way I can figure out how to do this is to <strong>manually</strong> socket.write the GET myself.</p>
  
  <p>What I'm hoping for is some class like http that allows you to do something like...</p>
  
  <pre><code>http.get(socket, function(res){  // Handler code  })
  </code></pre>
  
  <p>I'm almost positive the issue is do to me being a newb at NodeJS, so I spent about 3-4 hours scouring stackoverflow and google for an answer with so far no success.</p>