node.js - Sending sockets to client side, Error: Converting circular structure to JSON -
i'm working in node js , i'm trying send array, clients, server every client normal emit, keeps giving me error:
data = json.stringify(ev);
typeerror: converting circular structure json
shortly, do.
var clients = new array(); io.sockets.on('connection', function(socket) { clients.push(socket); socket.on('loginuser', function(data){ io.sockets.emit("getusers", clients); });
i've seen couple of other people having problem, answers didn't work out me.
looking @ bigger problem, can't send array of sockets client side. sockets objects make sense in current context/process. if want control sockets client side, instead add sort of rpc functionality.
Comments
Post a Comment