technoweenie / twitter-node

Discontinued: check out nTwitter
https://github.com/AvianFlu/ntwitter
MIT License
446 stars 547 forks source link

Connection refused #17

Open NHQ opened 13 years ago

NHQ commented 13 years ago

Hiya,

I tried throwing this in a quick app, but am getting connection refused and I can't figure out why. I read thru the module. I guess twitter is refusing the connection?

Error: ECONNREFUSED, Connection refused
    at Client._onConnect (net.js:601:18)
    at IOWatcher.onWritable [as callback] (net.js:186:12)

I've tried variously tracking and following. I also tried using the NPM version and a repo-cloned version, which I noticed had some big differences, one of them being http vs https. Niether worked, both returned the same error above. I also tried running the module on its own, not wrapped in an express app, as below. The app, mostly from your example:

var express = require('express');

var TwitterNode = require('twitter-node').TwitterNode
  , sys         = require('sys');

var app = module.exports = express.createServer();

var twit = new TwitterNode({
  user: 'astromanies', 
  password: '###',
  host: '74....',  
  port: 8000,                          
  track: ['baseball', 'football'],    
});

twit.addListener('error', function(error) {
  console.log(error.message);
});

twit
  .addListener('tweet', function(tweet) {
    sys.puts("@" + tweet.user.screen_name + ": " + tweet.text);
  })

  .addListener('limit', function(limit) {
    sys.puts("LIMIT: " + sys.inspect(limit));
  })

  .addListener('delete', function(del) {
    sys.puts("DELETE: " + sys.inspect(del));
  })

  .addListener('end', function(resp) {
    sys.puts("wave goodbye... " + resp.statusCode);
  })
  .stream();

// Configuration

app.configure(function(){
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(__dirname + '/public'));
});

app.configure('development', function(){
  app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); 
});

app.configure('production', function(){
  app.use(express.errorHandler()); 
});

app.listen(8080);
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
dustin10 commented 13 years ago

Hi. I submitted the patch for connecting over https and it is working for me. The only difference is that I am using the default host and port.

jorgeguberte commented 13 years ago

The patch indeed fixed the issue but the npm package isn't patched yet, as of October 9th.

anthonywebb commented 13 years ago

Still not updated :(

Tmeister commented 13 years ago

Hi, i have the same problem.

dustin10 commented 13 years ago

You need to clone the repo instead of using npm. The npm package does not contain the https fix.

Tmeister commented 13 years ago

Thanks @dustin10

FYI

If you need to use npm to deploy via package.json you can get the source from the last commit using something like this:

{ "name": "Your-app" , "version": "0.0.1" , "dependencies": { "twitter-node": "https://github.com/technoweenie/twitter-node/tarball/ec4eb261891d78a88faabea54ea1016fd884b804" } }

Cheers..

jorgeguberte commented 13 years ago

@Tmeister Great!