title: How to connect to a remote Node.js server?
body: <p>I'm using  <a href="http://C9.io" rel="nofollow">C9.io</a></p>
  
  <p>Here my server:</p>
  
  <pre><code>var io = require('socket.io');
  
  
    var socket = io.listen(8080, { /* options */ });
    socket.set('log level', 1);
  
  
    socket.on('connection', function(socket) {
  
          console.log("connected");
  
      socket.on('message1', function(data) {
            socket.emit("message1",JSON.stringify({type:'type1',message: 'messageContent'}));
  
      });
  
      socket.on('disconnect', function() {
  
           console.log("diconnected");
  
      });
    });
  </code></pre>
  
  <p>When i run it generate this url: <a href="https://xxx-c9-smartytwiti.c9.io" rel="nofollow">https://xxx-c9-smartytwiti.c9.io</a> and tell me that my code is running in this URL.</p>
  
  <p><strong>Note</strong>: xxx is my workspace</p>
  
  <p>What i did in my client:
  Connect to "<a href="https://xxx-c9-smartytwiti.c9.io:8080/" rel="nofollow">https://xxx-c9-smartytwiti.c9.io:8080/</a>"
  ....</p>
  
  <p>Then i get this error on console(firefox browser):</p>
  
  <pre><code>cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://xxx-c9-smartytwiti.c9.io:8080/socket.io/1/?t=1406060495041. This can be fixed by moving the resource to the same domain or enabling CORS.
  </code></pre>
  
  <p><strong>Note</strong>: when i host my server locally it works perfectly.</p>
  
  <p>Seems like c9.io using a proxy or a firewall, but how can i test my code written in the c9.io remotely ?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>According to ruben's response i've changed my server, and it works when my socket.io-client hosted in C9 but still can't get this working on remote client(i've also hosted the client in my FTP but same result):</p>
  
  <pre><code>// module dependencies
  var http = require("http"),
      sio  = require("socket.io");
  
  // create http server
  var server = http.createServer().listen(process.env.PORT, process.env.IP),
  
  // create socket server
  io = sio.listen(server);
  
  // set socket.io debugging
  io.set('log level', 1);
  
  
  io.set('origins', '*:*');
  
  
  io.sockets.on('connection', function (socket) {
  
  
    socket.emit('news', { message: 'Hello world!' });
  
    socket.on('my other event', function (data) {
      console.log(data.message);
    });
  
  });
  </code></pre>
  
  <p>Looks like  the origin configuration has been ignored, i'm also not sure about C9.io..</p>
  
  <p>suggestions ?</p>
  
  <p>Cheers.</p>