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

feat: socket reconnection optimization #994

Merged
merged 33 commits into from
Aug 28, 2024
Merged

feat: socket reconnection optimization #994

merged 33 commits into from
Aug 28, 2024

Conversation

abretonc7s
Copy link
Collaborator

@abretonc7s abretonc7s commented Aug 21, 2024

  • remove unnecessary wakelock management
  • optimize reconnect event for retrial and prevent conccurrent runs
  • fully reuse channelId with ecies config
  • utility to debug universal links
    image

Besides the high level changes described above, this PR also addresses long standing undetected bug when a connection is terminated from mobile, it is not possible to directly reconnect without refreshing the page.

Copy link

codecov bot commented Aug 21, 2024

Codecov Report

Attention: Patch coverage is 69.78417% with 84 lines in your changes missing coverage. Please review.

Project coverage is 80.70%. Comparing base (9e9f1ac) to head (61bfe0e).
Report is 1 commits behind head on main.

Files Patch % Lines
...kages/sdk/src/provider/initializeMobileProvider.ts 0.00% 21 Missing ⚠️
...oteConnection/ConnectionManager/startConnection.ts 69.56% 21 Missing ⚠️
...SocketService/ConnectionManager/reconnectSocket.ts 75.60% 10 Missing ⚠️
.../RemoteConnection/EventListeners/setupListeners.ts 58.82% 7 Missing ⚠️
packages/sdk/src/utils/base64.ts 33.33% 6 Missing ⚠️
...rvice/ConnectionManager/handleJoinChannelResult.ts 16.66% 5 Missing ⚠️
...oteCommunicationPostMessageStream/extractMethod.ts 66.66% 3 Missing ⚠️
...ices/SocketService/ChannelManager/createChannel.ts 85.71% 2 Missing ⚠️
...vice/ConnectionManager/setupSocketFocusListener.ts 87.50% 2 Missing ⚠️
packages/sdk/src/Platform/MetaMaskInstaller.ts 60.00% 2 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #994      +/-   ##
==========================================
+ Coverage   80.31%   80.70%   +0.39%     
==========================================
  Files         180      177       -3     
  Lines        4058     3990      -68     
  Branches     1007      990      -17     
==========================================
- Hits         3259     3220      -39     
+ Misses        799      770      -29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@abretonc7s abretonc7s changed the title feat: prevent duplicate events feat: socket reconnection optimization Aug 22, 2024
@abretonc7s abretonc7s marked this pull request as ready for review August 22, 2024 04:38
@abretonc7s abretonc7s requested a review from a team as a code owner August 22, 2024 04:38
@abretonc7s abretonc7s marked this pull request as draft August 22, 2024 09:03
@abretonc7s abretonc7s self-assigned this Aug 27, 2024
@abretonc7s abretonc7s marked this pull request as ready for review August 27, 2024 08:10
omridan159
omridan159 previously approved these changes Aug 27, 2024

document.getElementById('testLink').addEventListener('click', function () {
console.log('Testing link:', currentLink);
window.location.href = currentLink;

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

DOM text
is reinterpreted as HTML without escaping meta-characters.
Copy link

socket-security bot commented Aug 28, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@tanstack/query-core@5.52.2 environment 0 2.02 MB tannerlinsley
npm/@tanstack/react-query@5.52.2 environment 0 1.11 MB tannerlinsley
npm/wagmi@2.12.7 Transitive: environment, eval, filesystem, network, unsafe +37 70.9 MB awkweb

🚮 Removed packages: npm/@metamask/providers@10.2.1)

View full report↗︎

Copy link

@abretonc7s abretonc7s enabled auto-merge (squash) August 28, 2024 08:34
Copy link
Collaborator

@christopherferreira9 christopherferreira9 left a comment

Choose a reason for hiding this comment

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

LGTM (re-approving)

@abretonc7s abretonc7s merged commit 5af7cbf into main Aug 28, 2024
36 of 37 checks passed
@abretonc7s abretonc7s deleted the singleinstance branch August 28, 2024 08:35
@abretonc7s abretonc7s mentioned this pull request Aug 29, 2024
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.

3 participants