var racer = require('racer'); var BCSocket = require('browserchannel').BCSocket; racer.Model.prototype._createSocket = function(bundle) { var options = bundle.racerBrowserChannel; var base = options.base || '/channel'; if (bundle.mount) base = bundle.mount + base; base = 'http://localhost:3000' + base; /////////<====== Change this to the address and ///////// port of your Racer server. return new BCSocket(base, options); }; racer.init({ "queries": [], "contexts": { "root": { "fetchedDocs": {}, "subscribedDocs": {}, "fetchedQueries": {}, "subscribedQueries": {} } }, "refs": [], "refLists": [], "fns": [], "filters": [], "collections": {}, "racerBrowserChannel": { "reconnect": true, "hostPrefixes": null, "base": "/channel", "keepAliveInterval": 20000, "sessionTimeoutInterval": 30000, "cors": null, "headers": { "Content-Type": "text/plain", "Cache-Control": "no-cache, no-store, max-age=0, must-revalidate", "Pragma": "no-cache", "Expires": "Fri, 01 Jan 1990 00:00:00 GMT", "X-Content-Type-Options": "nosniff" } } }); racer.ready(function(model) { model.subscribe('people.520053830ec8ce34cfe72ab7', function(err) { if (err) throw err; // Now you can do something with the document you subscribed to. console.log(model.get('people.520053830ec8ce34cfe72ab7.name')); }); });