-
Notifications
You must be signed in to change notification settings - Fork 542
Open
Description
var TwitterNode = require('../lib').TwitterNode
, sys = require('sys')
, assert = require('assert');
var twit = new TwitterNode({
user: 'username',
password: 'password',
follow: [12345, 67890], // follow these random users
});
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();
setInterval(function() {
var user = Math.floor(Math.random() * 10000000);
sys.puts('Following '+user);
twit.follow(user);
twit.stream();
}, 1000);
Gives:
Following 9177227
Following 8287550
Following 5989591
wave goodbye... 200
Following 2983167
Following 9713078
wave goodbye... 200
Following 9638683
wave goodbye... 200
Following 7539247
wave goodbye... 200
Following 8320555
wave goodbye... 200
Following 4808738
Following 1493951
wave goodbye... 200
Following 7033565
wave goodbye... 200
Following 8097783
wave goodbye... 200
Following 8631714
wave goodbye... 200
The problem with this, is that now I get duplicate "tweet" events called for each existing connection that wasn't closed.
Metadata
Metadata
Assignees
Labels
No labels