title: server-side connection to a socket.io server
body: <p>I have a Java server that connects with web-browsers through web-sockets, specifically socket.io, specifically this implementation: <a href="https://github.com/mrniko/netty-socketio" rel="nofollow">https://github.com/mrniko/netty-socketio</a></p>
  
  <p>Now I would like to connect to the same server, not from a web-browser (through Javascript), but from a Node.JS program.</p>
  
  <p>The problem is, in all examples that I found, the Node.JS program is the server, and the clients are always web-browsers.</p>
  
  <p>I tried to use a code similar to the client connection code in node.js:</p>
  
  <pre><code>var io = require('socket.io');
  var socket = io.connect("http://localhost:9080");
  </code></pre>
  
  <p>but got this error:</p>
  
  <pre><code>TypeError: Object #&lt;Object&gt; has no method 'connect'
  </code></pre>