// this is a json fetcher for streams from cosm.com // to use, simply start "node cosmfetcher.js " // configuration var streams = [ 91755, 70632, 53146, 45582, 64590 ]; // configure which cosm streams to fetch var pollingInterval = 1000; // in ms var sendAlways = false; // if set to true, fetcher will always send osc messages // regardless if value changed // end configuration var restify = require('restify'), osc = require('node-osc'); var hubAddress = process.argv.length > 2 ? process.argv[2] : '192.168.23.43'; var hubPort = process.argv.length > 3 ? process.argv[3] : 7110; console.log("using " + hubAddress + ":" + hubPort + " as hub"); var oscClient = new osc.Client(hubAddress, hubPort); var cosmClient = restify.createJsonClient({ url: 'http://api.cosm.com', headers: { 'X-ApiKey':'orKBBdLAKuKJU-RxqmZpZB6q0baSAKxBTVhKdjhUNkdyVT0g' }, version:'*' }); var recentvalues = {}; setInterval(function() { for(var i=0; i