title: Socket.io Client Not Receiving Data from Server Correctly
body: <p>server.js</p>
  
  <pre><code>var app = require('http').createServer(handler)
    , io = require('socket.io').listen(app)
    , fs = require('fs')
  
  app.listen(process.env.PORT);
  
  function handler (req, res) {
    fs.readFile(__dirname + '/index.html',
    function (err, data) {
      if (err) {
        res.writeHead(500);
        return res.end('Error loading index.html');
      }
  
      res.writeHead(200);
      res.end(data);
    });
  }
  
  io.sockets.on('connection', function (socket) {
    socket.emit('message', { msg: 'world' });
    socket.on('message', function (msg) {
      console.log(msg);
      console.log('That was a message from the client :)');
    });
  });
  </code></pre>
  
  <p>index.html:</p>
  
  <pre><code>&lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    var socket = io.connect('EDITED');
    document.write("test");
    socket.on('message', function (msg) {
      alert(msg);
      //console.log(data);
      socket.emit('message', { msg: 'hello there server' });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>The server is accepting the message "hello there server" and displaying it correctly in the console;  However, when the server sends the message "hello" to the client, the client is supposed to give a pop up alert that should read "hello".  Instead of the pop up alert saying "hello", it says:  <strong>[object Object]</strong></p>
  
  <p>Any ideas?</p>