title: Transferring a text file's contents over socket.io results in a ArrayBuffer object
body: <p>I am a newbie with <code>socket.io</code> and have very little exposure to <code>node.js</code> as well</p>
  
  <p>So I started from the simple chat app and built my way up</p>
  
  <p>I can get text messages to be sent from a server to a client when the message comes from another client, like the chat demo app does</p>
  
  <p>But when trying to have the server read a local file and send this contents over using <code>io.emit</code>, what the client side receives seems to be an instance of <code>ArrayBuffer</code>, which in any case confuses the JSON parser</p>
  
  <p>More specifically, server side does</p>
  
  <pre><code>fs.watch('status.json', 
    function(event, filename){
      fs.readFile('status.json',
        function(err, data){
          if (err) throw err;
        io.emit("r2lab status", data);
        });
    });
  </code></pre>
  
  <p>and client side does </p>
  
  <pre><code>socket.on('r2lab status', function(json){
      console.log("received JSON nodes_info " + json);
      var nodes_info = JSON.parse(json);
      /* etc.. */
  </code></pre>
  
  <p>which at run-time triggers this in Console</p>
  
  <pre><code>received JSON nodes_info [object ArrayBuffer]
  r2lab.html:1 Uncaught SyntaxError: Unexpected token o
  ...
  </code></pre>
  
  <p>As the logic works when I am getting my input by another source than a file, this  all strongly suggests that the <code>data</code> I am getting out of <code>readFile</code> is not a plain string but some kind of instance that somehow makes it to the client side; like if I had opened my input file in binary or something.</p>
  
  <p>Could anyone suggest a means to get JSON.parse() to be happy with this scenario ? server-side or client-side, either way would be just fine with me.</p>
  
  <p>Many thanks </p>