The streaming api is great, but it sometimes closes the connection for
whatever reason. my realtime system must figure out when to reconnect
automatically.  the auto-reconnection can't blindly request a
connection whenever it is not connected, otherwise it will floor the
api and may cause the api to ban or refuse the user's request. it's
bad to bombard the api server with repeated connection requests.
Could the api team recommend some best practice for dealing with auto-
reconnection?

maybe certain error code or error message can indicate the cause of
dropping connection and wait time for next connection request. I just
a long list of exceptions from streaming api as a result of repeated
connection, and the different messages are:

twitter4j.TwitterException: Address already in use: connect
twitter4j.TwitterException: Authentication credentials were missing or
incorrect.
twitter4j.TwitterException: Connection refused: connect
twitter4j.TwitterException: No route to host: connect
twitter4j.TwitterException: Stream closed.
twitter4j.TwitterException: The request is understood, but it has been
refused.  An accompanying error message will explain why.
twitter4j.TwitterException: connect timed out

How to prevent such situation of repeated connections requests?

thanks,
aj

Reply via email to