var client;
Twitter.streamTwitter = function() {
client = new Twitter({
"consumer_key": process.env.TWITTER_CONSUMER_KEY,
"consumer_secret": process.env.TWITTER_CONSUMER_SECRET,
"access_token_key": process.env.TWITTER_ACCESS_TOKEN_KEY,
"access_token_secret": process.env.TWITTER_ACCESS_TOKEN_SECRET
});
var stream = client.stream('statuses/filter', {track: 'XXXXX'}); // where XXXXX is the keyword i looking for
stream.on('data', function(tweetReceived) {
console.log(tweetReceived);
});
stream.on('error', function(error) {
throw error;
});
}
This code work sometimes, and some over time not
For example this night, it’s work and one hour after without touch any code it doesn’t work.
This code is in a worker nodejs for multithreating.
The only answer i see is that twitter banned me because i have more than one connection by ip. But this code is launch one time and listen indefinitely.
Thanks for your answer by the way.