var restify = require('restify') , util = require('util') , EventEmitter = require('events').EventEmitter; // constructor function function Cosm(streams, key) { var self = this; self._streams = streams; self._interval = 5000; self._jsonClient = restify.createJsonClient({ url: 'http://api.cosm.com', headers: { 'X-ApiKey': key }, version:'*' }); var recentvalues = {}; setInterval(function() { for(var i=0; i