Connection policy of the Streaming API


#1

Hello there,

What is the connection policy of the Streaming API? Can I start and stop regulary my connection of the stream?
I need to change my tracking (POST) values whatever i want. There is a problem (with the limitation policy for exemple)?

Today, the idea is to close the current connexion (if is she exists) and start a new one with the new post values.

If this is not good, what is your advice to do that?
Also can i filter by language with the Streaming API? I use the “public” stream.

Sorry for my English. Thank you for your help.
Regards


#2

It is possible to become rate limited if you attempt to connect too many times in a short time window. If you’re staying connected for longer periods and only disconnecting to update your query parameters, you should be fine. Keep in mind that if you see a HTTP 420 or a HTTP 429 message, you’ll need to back off for long enough that you don’t see the message again (1 minute should be sufficient)


#3

Thank you for the reply.
Could you clarify how to use the “language” filter? How get the tweets of specific languages with the Streaming API? I tried “language=fr” and this is not working. Thank you


#4

Could you be more specific about what is not working? I just connected to https://stream.twitter.com/1.1/statuses/sample.json?language=fr and every Tweet came back with a “lang”:“fr” attribute.


#5

My mistake. It was a another issue with the OAuth signature.
Have you some tips to track words with and without accent ?

For example, if I need to track “français”. There is a way to avoid track=français,francais and get those two results? Thanks again!


#6

You may try splitting your query terms around such characters. It’s a bit hard to explain, but try using the tool at https://dev.twitter.com/docs/streaming-apis/keyword-matching to get a sense of which keyswords may match which Tweets