Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconnect on hangup or timeut #201

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

stephenwithav
Copy link

@dtvd if you're okay with the PR suggested in #199 (comment) ... here you go. 😃

rainbowstreamをありがとうございました.

    -rename stream to stream_aux
    -stream_aux returns whether or not to reconnect
    -add new stream function to handle reconnects
@ghost
Copy link

ghost commented Oct 24, 2016

@stephenwithav Do your changes help with the Hangup errors?

@stephenwithav
Copy link
Author

@ManasB the changes will automatically reconnect after receiving a Hangup message if AUTO_RECONNECT is true.

@orakaro
Copy link
Owner

orakaro commented Oct 25, 2016

Hi @stephenwithav, thanks for contribution.
Does this prevent hangup happens after reconnect ?

@ghost
Copy link

ghost commented Oct 25, 2016

@dtvd

I think it will attempt to reconnect upon a Hangup or Timeout (if the setting is enabled)
@stephenwithav should clarify this though

With regards to preventing a Hangup/Timeout, if it isn't an error/disconnect on the client's side then there's not much to prevent? I'm familiarizing myself with rainbowstream's code. Thank you for developing this program!

I think having a 'Reconnect on Hangup/Timeout' is useful, though you may run into Twitter's connection rate limit. Now that I think of it, I guess that my errors were related to hitting Twitter's rate limit.

@orakaro
Copy link
Owner

orakaro commented Oct 25, 2016

Yes reaching rate limit was my concern. Automatically reconnecting can lead to rate limit easily and in theory you will be blocked for a while before you can try again. So best practice maybe limit (for example, 3 times) of reconnecting.

@stephenwithav
Copy link
Author

Can you provide a link to Twitter's rate limit documentation?

This code simply reconnects when a Hangup message is received--or there's a heartbeat timeout.

@orakaro
Copy link
Owner

orakaro commented Oct 25, 2016

https://dev.twitter.com/streaming/overview/connecting

Yes this wraps calling TwitterStream inside a while loop without limit. I guess we will need some backoff strategies.

@stephenwithav
Copy link
Author

Thank you, @dtvd. The docs suggest delaying reconnect attempts in increments of 250ms up to 16s, which shouldn't be difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants