-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo1.coffee
32 lines (26 loc) · 1.02 KB
/
demo1.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env coffee
Hydrant = require 'hydrant'
{inspect} = require 'util'
hydrant = new Hydrant
defaults:
encoding: no # yaml, json, none
compress: no # deflateRaw, deflate, gzip, or none
twitter:
module: './input/twitter'
consumer_key: 'CONSUMER_KEY'
consumer_secret: 'CONSUMER_SECRET'
access_token_key: 'ACCESS_TOKEN_KEY'
access_token_secret: 'ACCES_TOKEN_SECRET'
endpoint: 'statuses/filter' # or 'statuses/sample' (remove 'search' in this case)
search:
track: 'node,javascript,clojure'
# you can pass conditions to ignore some entries of the flow
# warning: they are directly executed by Node, so be sure
# your Hydrant config file come from a trusted source!
ignores: [
"data.text.length < 40" # if you are using json/yml, you can use plain text
(-> Math.random() > 0.05) # or if you are in a JS/Coffee context, use some real code!
]
hydrant.on 'input', (msg) ->
console.log " >> INPUT #{inspect msg}"
hydrant.start()