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: add onDisconnect callback to subscription #2684

Merged
merged 11 commits into from
Sep 2, 2024
Merged

Conversation

krissvaa
Copy link
Contributor

@krissvaa krissvaa commented Aug 30, 2024

The onDisconnect callback is called on reconnect.
This allows the Flux Connection to call the registered onDisconnect callbacks on reconnect.
If the state is already RECONNECTING, subsequent calls to onReconnect will not trigger calling the onDisconnect callbacks multiple times.

Fixes: #398

Also as long-polling has issues with flux connections only websocket connection is supported.
Long polling can still be enabled by passing atmosphere options from Connect.ts

Copy link

codecov bot commented Aug 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.33%. Comparing base (d7c8b31) to head (9e1b002).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2684      +/-   ##
==========================================
+ Coverage   92.29%   92.33%   +0.04%     
==========================================
  Files          76       76              
  Lines        2479     2492      +13     
  Branches      643      646       +3     
==========================================
+ Hits         2288     2301      +13     
  Misses        144      144              
  Partials       47       47              
Flag Coverage Δ
unittests 92.33% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@taefi taefi changed the title feat: before flux reconnect callbacks for clean up feat: add onDisconnect callback to subscription Aug 30, 2024
Copy link
Contributor

@taefi taefi left a comment

Choose a reason for hiding this comment

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

Generally, looks good to me, though I changed the PR title and description according to my understanding of the changes in this PR.
I requested review from @platosha.

@platosha
Copy link
Contributor

Looks good overall. Please address the red build.

Copy link

sonarcloud bot commented Sep 2, 2024

@taefi taefi merged commit a18de56 into main Sep 2, 2024
15 checks passed
@taefi taefi deleted the feat/socket-reconnect branch September 2, 2024 08:29
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Hilla 24.5.0.alpha12 and is also targeting the upcoming stable 24.5.0 version.

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

Successfully merging this pull request may close these issues.

[push] There is no API for handling reconnect / resubscribe
4 participants