Created
June 24, 2013 21:41
-
-
Save garbados/5853858 to your computer and use it in GitHub Desktop.
Example of pushing data to a Geckoboard widget. Based on this documentation: http://docs.geckoboard.com/custom-widgets/push.html Specific to the "numbers" widget. Find more widget specs here: http://docs.geckoboard.com/custom-widgets/index.html#types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = require("./config") | |
, request = require("request") | |
, i = 0; | |
function ping(){ | |
request.post({ | |
url: config.push_url, | |
json: { | |
api_key: config.api_key, | |
data:{ | |
item: [{ | |
// value, which is... | |
text: "", | |
value: i | |
},{ | |
// ...relative to this value | |
text:"", | |
value: 100 | |
}] | |
} | |
} | |
}, function(e, r, b){ | |
if(e) throw e; | |
console.log(b); | |
i++; | |
}); | |
} | |
// push data every second | |
setInterval(ping, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"push_url": "https://push.geckoboard.com/v1/send/...", | |
"widget_key": "...", | |
"api_key": "..." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment