Compare 2 circular structure JSON objects

I need to compare 2 websocket connections on my nodejs webserver. i cant just use json.stringify because the objects are circular structure. What to do?

As suggested at How to debug node.js applications a great tool for debugging complex structures in node is to use node-inspector: https://github.com/dannycoates/node-inspector

Underscore.js includes a _.isEqual method that does this:

var _ = require('underscore');
_.isEqual(obj1, obj2);

http://underscorejs.org/