Skip to content

Instantly share code, notes, and snippets.

@justoneplanet
Created October 11, 2011 17:09
Show Gist options
  • Save justoneplanet/1278705 to your computer and use it in GitHub Desktop.
Save justoneplanet/1278705 to your computer and use it in GitHub Desktop.
node.jsでtwitterのstreamにhttpsで接続する
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