Real time graphics with Node.JS

I am new to Node JS and Socket.IO and almost new to JS... I am trying to make, just to learn, a mini multiplayer game. I make all the processing of the position of the players in the server and I pass all the positions to each client so that each one makes all the graphs in the browser.

In the server side I have these:

function Player(x,y){
    some things...
    this.graph = '';
}
setInterval(function(){
    for (i in players){
    players_position(players[i]);
    }
    io.sockets.emit('new_data', players); 
}, 100);

(with this I send every 100 ms all the players position)

Then in the client side:

var r = Raphael('field', 800, 600)
for (i in players){
        players[i].graph = r.circle(players[i].x,players[i].y).attr({fill:'blue'});
        players[i].graph = players[i].graph.attr({cx : players[i].x , cy:players[i].y});

(this makes a graph of each player at the beginning and it works fine)

   socket.on('new_data', function(players){
            for (i in players){
                players[i].graph = players[i].graph.attr({cx : players[i].x , cy:players[i].y});


}

MY PROBLEM is that here it says that this has no method ATTR. As if the object.graph was not actually what I want it to be. I hope I have made myself clear enough. If not, please tell me.

Thank you very much.

your question is a little bit unclear, but i think you are trying to pass the whole raphael object over socket.io ?

socket.on('new_data', function(players){
   // here players is just a plain object without any methods
}

just make a console.log(players) in your browser and you will see whats going on. a few lines of code i hope this will give you an idea.

var local_players = [] // < store your clientside players and the raphael objects

socket.on('new_data', function(playerdata){
//for every player data recieved update your local players data..
  for(var i in playerdata)
    local_players[i].attr({cx : playerdata[i].x , playerdata[i].y});
}

you will also have to make sure that every player gets his player data, so give every player an unique id, if the id from the playerdata is the same update the player position.