Created
September 13, 2011 22:32
-
-
Save cronopio/1215374 to your computer and use it in GitHub Desktop.
Playing with hook.io
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
gmon.out | |
node_modules/ |
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
{} |
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
{ | |
"name":"testHookio", | |
"version": "0.0.1", | |
"dependencies": { | |
"hook.io-request": "0.3.x" | |
} | |
} |
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
#!/usr/bin/env node | |
var RequestHook = require('hook.io-request').RequestHook; | |
var test = new RequestHook({ | |
name: "mtgox", | |
debug:true | |
}); | |
test.on('hook::ready', function(){ | |
test.emit('*::sendRequest', {"url":"https://mtgox.com/api/0/data/ticker.php","headers":{ | |
"User-Agent": "Hook.IO-Script/0.1" | |
}}); | |
}); | |
test.on('gotResponse', function(data){ | |
console.log ('Ticker MtGox'); | |
console.log(data.body); | |
}); | |
test.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI, new
Hook.emit
api supports callbacks. I'll need to tweakhook.io-request
slightly, but it will be very easy.