-
Notifications
You must be signed in to change notification settings - Fork 520
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
Client event listener duplicates after browser reopening (Mostly mobile). #2486
Comments
Having worked with websocket many times before, I believe this is an expected behavior, because the browser tends to stop the ws connection when it does not have heartbeat messages being exchanged back and forth and the browser is not 'focused'. In this case, you may need some code that would refresh the page or sth inside the connected callback. It will be easier to debug if u attach an event listener to other types of events like 'disconnected' if they exist. |
I've tried using the "disconnected" event listener, but unfortunately the web browser never calls it upon closing the app, it only works when closing the tab or redirecting to other url. A page refresh would definitely be a workaround, as you suggest. |
@josemq2000 have you tried xrpl-client? Might help narrow down what the root cause is. |
At this point, xrpl.js is so embedded in my project that it would require a lot of work to refactor everything, but it would be worth a try. |
I just mean as a small proof of concept. |
Each time the browser is reopened, a new instance of the event listener is created.
How to reproduce:
main.js
index.html
Sandbox url: https://playcode.io/1603411
Tested on Safari and Chrome for iOS.
The text was updated successfully, but these errors were encountered: