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

Documentation: closeOnBeforeUnload #4770

Closed
christopherreay opened this issue Jul 17, 2023 · 3 comments
Closed

Documentation: closeOnBeforeUnload #4770

christopherreay opened this issue Jul 17, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@christopherreay
Copy link

christopherreay commented Jul 17, 2023

Describe the bug
description of operation of function is unclear
https://socket.io/docs/v4/client-options/#closeonbeforeunload

To Reproduce
Read docs for the function

Expected behavior
Describing things only in terms of negatives leaves the developer unsure of what actually is happening.

With closeOnBeforeUnload set to false

  • Firefox will cause a disconnect event to be emitted by the Socket instance when the user reloads the page
    • Chrome or Safari will not.
  • Chrome and Safari will cause a close event to be emitted by the Socket instance

With closeOnBeforeUnload set to true

  • all browsers will have the same behavior (no disconnect event when reloading the page)
  • all browsers will cause a close event to be emitted by the Socket instance
  • Beware this might cause result in undetermined behaviour if you use the beforeunload independently in your application code.

Platform:
n/a
Additional context

@christopherreay christopherreay added the to triage Waiting to be triaged by a member of the team label Jul 17, 2023
darrachequesne added a commit to socketio/socket.io-website that referenced this issue Aug 4, 2023
@darrachequesne
Copy link
Member

Hi! I have updated the documentation for the closeOnBeforeUnload option: https://socket.io/docs/v4/client-options/#closeonbeforeunload

Could you please check if that's clearer now?

@darrachequesne darrachequesne added documentation Improvements or additions to documentation and removed to triage Waiting to be triaged by a member of the team labels Aug 4, 2023
@christopherreay
Copy link
Author

christopherreay commented Aug 4, 2023 via email

darrachequesne added a commit to socketio/socket.io-website that referenced this issue Aug 4, 2023
@darrachequesne
Copy link
Member

@christopherreay thanks for your feedback 🙏

I've added a screenshot for both cases. I think we can now close this, please reopen if needed.

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

No branches or pull requests

2 participants