title: socket.io client not receiving messages from server
body: <p>I'm trying to implement a system with two clients one of them sends a message and the other one shall receive it.
  The figure below will explain it in a more visual way:</p>
  
  <p><img src="https://i.stack.imgur.com/f0rMO.jpg" alt="socket.io message communication chart"></p>
  
  <p>So, the client 1 send the message to the server (and this works), the server receives a "push" message and emits a "pop" message that should be picked up by Client 2. 
  The problem here is that Client 2 never receives the "pop" message. :(</p>
  
  <p>Here's the code for all of them.</p>
  
  <p><strong>SERVER.JS</strong></p>
  
  <pre><code>var app = require('express').createServer()
    , io = require('socket.io').listen(app);
  
  app.listen(999);
  
  app.get('/webclient', function (req, res) {
      res.sendfile(__dirname + '/web.html');
  });
  
  app.get('/mobile', function (req, res) {
      res.sendfile(__dirname + '/mobile.html');
  });
  
  io.sockets.on('connection', function (socket) {
  //      socket.emit('pop', { hello: 'world' });
      socket.on('push', function (data) {
          console.log('push received, emitting a pop');
          socket.emit('pop', { hello: 'world' });
      });
  });
  </code></pre>
  
  <p><strong>CLIENT 1 ( aka mobile.html )</strong></p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;
              Mobile
          &lt;/title&gt;
          &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
          &lt;script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js" type="text/javascript"&gt;&lt;/script&gt;
          &lt;script&gt;
            var socket = io.connect('http://localhost:999');
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;input type="button" name="act" id="push" value="message" /&gt;
          &lt;script type="text/javascript" charset="utf-8"&gt;
              window.addEvent('domready', function() {
                  $('push').addEvent('click', function() { 
                      socket.emit('push', { hello: 'world' });
                  });
              });
          &lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>CLIENT 2 (aka web.html)</strong></p>
  
  <pre><code>&lt;script src  = "/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    var socket = io.connect('http://localhost:999');
    socket.on('pop', function (data) {
      console.log(data);
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>I just cannot understand the reason why Client 2 does not receive the "pop" message, 
  I'm quite new to socket.io and node.js in general so some mechanics to me are still a bit obscure, so I apologize in advance for my noobness. :)</p>
  
  <p>cheers</p>
  
  <p>-k-  </p>