I am making a small application build on node.js, which needs real time tweets from the users twitter account. I have used for that "Twit" ( node.js library, look at this ) and write following code at server side.
var Twit = require('twit');
var T = new Twit({
consumer_key: '...',
consumer_secret: '...',
access_token: '...',
access_token_secret: '...',
timeout_ms: 60*1000, // optional HTTP request timeout to apply to all requests.
});
var userids = '100001,100002,100003';
T.stream('statuses/filter',
{
follow: userids,
stall_warnings: true
},
function(stream) {
stream.on('tweet', function (tweet) {
console.log(tweet);
});
}
);
I have to use stream because I need real time tweets of the users (100001,100002 and 100003). I have seen many example, shows me same code. But in my case it is not working. If I pass single userid (e.g. 100001), it works sometime, sometime not. Don't know what is the problem with this code. Can anybody help me solve it out.
Thanks.