I'm working in node JS and I'm trying to send an array, with my clients, from the server to every client with a normal emit, but it keeps giving me this error:
data = JSON.stringify(ev);
TypeError: Converting circular structure to JSON
Shortly, this is what I 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 a couple of other people having this problem, but all those answers didn't work out for me.