I am creating a small application on node.js that requires real-time tweets from a twitter user account. I used this "Twit" library (node.js, looked this ) and wrote the following code on the 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 need to use the stream because I need real-time tweets for users (100001, 100002 and 100003). I saw many examples, shows me the same code. But in my case, this does not work. If I pass one user ID (e.g. 100001), it works sometime, and sometimes not. I donβt know what the problem is with this code. Can someone help me solve this problem.
Thanks.
source share