Streaming API (statuses/filter) stops giving data intermittently




I am using twitter streaming API (statuses/filter) with track option to listen to tweets and perform subsequent operations. Frequency of the tweet is about 1.5 tweets per second.
However, after working for 3 or 4 days(sometimes just for a day) , it stops giving tweets. I am using nodejs and verified that the script was up and internet connection was stable too.

Can you please tell where the fault could be ? Is it related to auth tokens ? permissions ?



Keeping a stream running forever is a little tricky. Your program will have to handle all the following:

  • stalls, i.e. no data for over 90 seconds
  • twitter disconnecting
  • socket unreliability

At a minimum, you need to inspect the error you receive when the stream stops.


Thanks for the reply

Though I keep monitoring the stream and restart the streaming script when I detect the stagnancy but not sure what you mean by stalls…

Does the API stops giving tweets if no tweet is obtained for 90 seconds ?


Stalls are explained here.

If there are no tweets in your stream, Twitter is supposed to send a new line every 30 seconds. If you don’t see tweets or new lines for 90 seconds, probably your reconnection needs to be reestablished.