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

Proper websocket (dis)connect when windows is hidden and restored #4181

Merged
merged 2 commits into from
Aug 22, 2022

Conversation

naltatis
Copy link
Member

Leveraging the Page Visibility API to detect if the browser window is hidden (minimise, behind a window, app-switch). In this cases we perform a proper web socket disconnect and establish a fresh connection once its visible again.

I hope this fixes the issue with evcc not updating after longer inactivity #3504.

Another advantage: We save energy and bandwidth by not fetching data that nobody sees.

@naltatis naltatis requested a review from andig August 21, 2022 14:46
@naltatis naltatis added the bug Something isn't working label Aug 21, 2022
@andig
Copy link
Member

andig commented Aug 21, 2022

Ich kann nicht beurteilen ob das einen echten Vorteil bringt.

@naltatis
Copy link
Member Author

@andig die Berücksichtigung von Page Visibility ist generell ne gute Idee. Ich kann mir gut vorstellen, dass das unser Problem auch löst oder mindert, konnte das aber natürlich nicht in der Fläche testen. Daher würd ich vorschlagen, dass wir das reinnehmen und schauen wie das Feedback ist.

@andig andig merged commit 5b29dac into master Aug 22, 2022
@andig andig deleted the fix/better_websocket_handling branch August 22, 2022 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants