Streaming API ON/OFF


#1

I am having issues with streaming api, it suddenly stops working. The clock is synchronized. The credentials are correct. After some time it starts working again without any changes in code or authentication. What can be the reason for this intermittent behavior?


#2

Hello Arshad, could you please elaborate on which endpoint you are using and which errors you are receiving from the API so we can help? Thanks!


#3

Hello Romain,

I am using streaming API for public streams by location. I am getting 401 unauthorized error intermittently.


#4

Is there a rate limit on streaming API for fetching tweets by location? If yes, then how much is the rate limit and how do I know I have hit the rate limit, and any suggestions on how I deal with it. Please let me know. Also, the code is working fine on development server, I am facing the 401 unauthorized error when I deploy it on production server (Please note that the clock is synchronized.)


#5

We are waiting for the reply, since the streaming on production is stopped. Kindly reply at the earliest.


#6

Take a look at the section on “Stalls” in this documentation page:

https://dev.twitter.com/docs/streaming-apis/connecting#Stalls

If you receive no data in a 90 second interval, Twitter asks that you disconnect and immediately reconnect your streaming connection.


#7

Arshad,

Thanks for the additional details. Because of the nature of the connection in the case of Streaming APIs, there is no “rate limiting” per say. The Streaming APIs work with a long lived connection to Twitter so that you can receive Tweets in real-time as they come in.

Am I correct in thinking that you are using [node:10389] with the locations parameter?

When you say you encounter 401 errors “intermittently”, is it because you are trying to connect many times and some attempts are succeeding?

Thanks for the note on the time sync. Additionally, if you want to be sure you can double check this by looking at the “Date” HTTP header in all Twitter API responses.

I hope this helps. Thanks!