Skip to content

Instantly share code, notes, and snippets.

@ciaranj
Created September 22, 2011 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ciaranj/1234827 to your computer and use it in GitHub Desktop.
Save ciaranj/1234827 to your computer and use it in GitHub Desktop.
Seemingly working HTTP(s) userstream connection.
var sys= require('sys');
var OAuth= require('oauth').OAuth;
oa= new OAuth("https://twitter.com/oauth/request_token",
"https://twitter.com/oauth/access_token",
yourConsumerKey, yourConsumerSecret,
"1.0A", "http://localhost:3000/oauth/callback", "HMAC-SHA1");
var request= oa.get("https://userstream.twitter.com/2/user.json", yourAccessToken, yourTokenSecret );
request.addListener('response', function (response) {
response.setEncoding('utf8');
response.addListener('data', function (chunk) {
console.log(chunk);
});
response.addListener('end', function () {
console.log('--- END ---')
});
});
request.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment