Created
October 11, 2011 17:09
-
-
Save justoneplanet/1278705 to your computer and use it in GitHub Desktop.
node.jsでtwitterのstreamにhttpsで接続する
This file contains hidden or 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 auth = 'Basic ' + new Buffer('username:password').toString('base64'); | |
var options = { | |
"host" : "stream.twitter.com", | |
"port" : 443, | |
"path" : "/1/statuses/filter.json?follow=123456789", | |
"method" : "GET", | |
"Authorization" : auth | |
}; | |
var request = https.request( | |
options, | |
function(response) { | |
console.log('statusCode: ', response.statusCode); | |
console.log('headers: ', response.headers); | |
sys.puts('response'); | |
var chunk = ''; | |
response.on( | |
'data', | |
function(data){ | |
} | |
); | |
} | |
); | |
request['_headers']['Authorization'] = auth; | |
request['_headerNames']['Authorization'] = 'Authorization'; | |
request.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment