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

Fix websocket issue with pre android sdk 24 devices #284

Merged
merged 3 commits into from
Aug 11, 2020

Conversation

daniellevass
Copy link
Contributor

@daniellevass daniellevass commented Aug 5, 2020

Description of the pull request

Issue #283 when we updated the websocket library.

I could reproduce this crash myself with an emulator running 5.1 and the current version of the library.

I followed the instructions on the websocket library to fix this issue. There was a discussion around the issue for those interested here. And the public interface has been documented.

I have also surrounded the call super method with a try so android 24+ devices can get the benefit.

I have tested on my emulator that this version does not crash and connects as expected.

Additional

Turned out there was an issue with using map.replace for the encrypted channels on old versions of android - I fixed this too by using map.put instead.

@daniellevass daniellevass self-assigned this Aug 5, 2020
@daniellevass daniellevass linked an issue Aug 5, 2020 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Aug 5, 2020

Codecov Report

Merging #284 into master will decrease coverage by 0.16%.
The diff coverage is 20.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #284      +/-   ##
============================================
- Coverage     76.25%   76.08%   -0.17%     
  Complexity      284      284              
============================================
  Files            31       31              
  Lines          1798     1802       +4     
  Branches        137      137              
============================================
  Hits           1371     1371              
- Misses          371      375       +4     
  Partials         56       56              
Impacted Files Coverage Δ Complexity Δ
...t/connection/websocket/WebSocketClientWrapper.java 44.11% <0.00%> (-5.89%) 7.00 <0.00> (ø)
...ient/channel/impl/PrivateEncryptedChannelImpl.java 96.20% <100.00%> (ø) 21.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d5e60c5...2b96533. Read the comment docs.

@elverkilde elverkilde requested a review from WillSewell August 10, 2020 08:22
Copy link

@callum-oakley callum-oakley left a comment

Choose a reason for hiding this comment

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

my Android knowledge is limited but this looks sensible to me

@WillSewell
Copy link
Contributor

The workaround instructions imply that if you no longer call setEndpointIdentificationAlgorithm, then you should "Perform the hostname validation after you connected to the server". I assume that should also be included in this PR or hostnames will no longer be validated with older versions of Android (I assume they were before we upgraded the websocket library).

@daniellevass
Copy link
Contributor Author

Hm, I had thought about that - but I'm not sure what exactly we'd need to do or where it would need to go. Considering this won't be affecting many (less than 15% of android devices are running pre-24) - and I presume this won't impact people who run channels from pusher (at least when I tested on an android device it worked fine) - is it worth the extra effort to delay the release, and if so, can we set some time up to talk about it?

@WillSewell
Copy link
Contributor

Ah I see - I had assumed that the old version of the websocket library was doing hostname validation some other way - but it doesn't look like it did. Since that's the case I think it's fine to not do it for old clients (since it wasn't previously done at all!).

Copy link
Contributor

@WillSewell WillSewell left a comment

Choose a reason for hiding this comment

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

Looks good!

@daniellevass daniellevass merged commit 101241f into master Aug 11, 2020
@daniellevass daniellevass deleted the dev-fix-set-ssl-parameters-2 branch August 11, 2020 09:35
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.

NoSuchMethodError Pusher 2.2.4 with Android 6
4 participants