title: Connecting to socket.io server from c++ application
body: <p>I am trying to do poc for my web based application, I have following</p>
  
  <p>1) A basic node.js/socket.io based server on LINUX that serves basic web page as a client</p>
  
  <p><strong>client.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
  
       var socket = io.connect("169.xxx.xxx.xx:5000");
  
       socket.on("aServerEvent", function(data)
       {
         document.getElementById("chatlog").innerHTML = ("&lt;hr/&gt;" +
         data['message'] + document.getElementById("chatlog").innerHTML);
       });
  
       function sendMessage()
       {
          var msg = document.getElementById("message_input").value;
          socket.emit("aClientEvent", { message : msg});
       }
      &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;input type="text" id="message_input"/&gt;
      &lt;button onclick="sendMessage()"&gt;send&lt;/button&gt;
      &lt;div id="chatlog"&gt;&lt;/div&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>server.js</strong></p>
  
  <pre><code>var app = require('http').createServer(handler),
      io = require('socket.io').listen(app),
      fs = require('fs')
      app.listen(5000,'169.xxx.xxx.xx');
  
  function handler (req, res)
  {
      fs.readFile("client.html", function (err, data)
      {
          if (err)
          {
              res.writeHead(500);
              return res.end('Error loading client.html');
          }
          res.writeHead(200);
          res.end(data);
      });
  }
  
  console.log('Server running at http://169.xxx.xxx.xx:5000/');
  
  io.sockets.on('connection', function(socket)
  {
      socket.on('aClientEvent', function(data)
      {
          var newData = "serverResponse: " + data["message"].toUpperCase();
          io.sockets.emit("aServerEvent", { message: newData });
      });
  });
  </code></pre>
  
  <p>So far so good, I input a text on the webpage(client) that gets read by server which returns upper case text as acknowledgment.</p>
  
  <p>2) Now I want to write a basic C++ program on linux using websocketpp to establish a websocket based connection with my node.js/socket.io server </p>
  
  <p>What is the best way to do that i.e how can I establish a websocket based connection between node.js server and c++ application (websocketpp based) ?</p>
  
  <p>The closest matches I found are..</p>
  
  <pre><code>https://github.com/ebshimizu/socket.io-clientpp 
  </code></pre>
  
  <p>(however uses rapidjson, I want to use libjson only)</p>
  
  <pre><code>https://github.com/uning/socket.io-client-cpp 
  </code></pre>
  
  <p>(this looks like amended version of original websocketpp libraries and has lots of files in src which confuses me if all of them are required)</p>
  
  <p>Any pointer would be much apreciated</p>
  
  <p>Thanks in advance</p>