TypeError: io.connect is not a function
<p>I am following a tutorial for a simple multiplayer game using node js and socket.io (<a href="http://rawkes.com/articles/creating-a-real-time-multiplayer-game-with-websockets-and-node.html" rel="nofollow">http://rawkes.com/articles/creating-a-real-time-multiplayer-game-with-websockets-and-node.html</a>) . I am having a problem when i am trying to connect to the socket server.I get an error saying 
TypeError: io.connect is not a function
PS : i am a total beginner in node js and socket.io so please help me out.</p>

<pre><code>var util = require("util");
io = require("socket.io"),
    Player = require("./Player").Player;
var socket, players;
function init(){
    players = [];

    socket = io.listen(8000);

    socket.configure(function() {
        socket.set("transports", ["websocket"]);
        socket.set("log level", 2);
    });

    setEventHandlers();

    socket = io.connect("http://localhost", {port: 8000, transports: ["websocket"]});

};
</code></pre>