https://github.com/stil4m/dash-client
Dash Client
https://github.com/stil4m/dash-client
Last synced: 2 months ago
JSON representation
Dash Client
- Host: GitHub
- URL: https://github.com/stil4m/dash-client
- Owner: stil4m
- License: apache-2.0
- Created: 2014-11-27T18:01:54.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-21T21:02:12.000Z (about 10 years ago)
- Last Synced: 2025-01-21T18:51:45.995Z (4 months ago)
- Language: JavaScript
- Size: 266 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dash Client
This Dash Client can be used to add data to a Dash Server.
It can be used as
## Simple run
```
//Setup runner
var Runner = new require('dash-client').Runner;
var runner = new Runner({ url : 'http://your-dash-url'});//Add tasks
runner.addTask('context', 'entity', function(lastTimestamp, cb) {
console.log("The last data in dash for the context", context ,"and entity", entity, "is: ", lastTimestamp);
//Call the callback with an Array of the data that should be added to Dash (conform to the dash specified format)
cb([{
key : 'OVER',
value : 9000,
timestamp : new Date().getTime()
}]);
});//Start
runner.start();
```## Cron
You can add the cron option to the start function to make the Runner execute as a cron and use the intervals.
```
var myTask = function(lastTimestamp, cb) {
...
};//Add a task with an interval of 5 minutes
runner.addTask('context', 'entity', myTask, { interval : 300});//Start the runner as cron
runner.start({cron : true});
```