FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Don't reconnect when codes in 40xx range are received by kn100 · Pull Request #187 · pusher/pusher-websocket-java · GitHub

Don't reconnect when codes in 40xx range are received - #187

Merged
kn100 merged 2 commits into
masterfrom
dont_reconnect_on_40xx
Sep 27, 2018
Merged

Don't reconnect when codes in 40xx range are received#187
kn100 merged 2 commits into
masterfrom
dont_reconnect_on_40xx

Conversation

kn100 commented Aug 28, 2018

Copy link
Copy Markdown
Contributor

Description of the pull request

Currently, the library ignores Pusher codes and therefore attempts reconnections. I have a feeling this will cause issues with future feature work we may do, so here's a fix.

Why is the change necessary?

Respecting protocol.


CC @pusher/mobile

// Received error codes 4000 >= 4099 indicate we shouldn't attempt reconnection
// https://pusher.com/docs/pusher_protocol#error-codes
private boolean shouldReconnect(int code) {
return !(code >= 4000 && code <= 4099);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd personally find this easier to read without the negative, i.e. code < 4000 || code >= 4100, but it's not a big deal.

}, reconnectInterval, TimeUnit.SECONDS);
}

// Received error codes 4000 >= 4099 indicate we shouldn't attempt reconnection

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm not clear what 4000 >= 4099 precisely means. What about the notation the docs use 4000-4099?

kn100 merged commit 1894ed2 into master Sep 27, 2018
kn100 deleted the dont_reconnect_on_40xx branch September 27, 2018 14:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL