-
Notifications
You must be signed in to change notification settings - Fork 57
feat: connect/disconnect on window focus/blur #528
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
base: main
Are you sure you want to change the base?
Conversation
|
We have seen some @kptdobe how does this work if I want to move to a different window (or desktop) to drag and drop an image? My gut says we should probably put this behind a 10 minute timeout so it doesn't immediately close the connection if you're doing document comparisons, etc. Even with a 10 minute timeout, I think this will still alleviate the issues we're seeing in logs. I think we probably also want to put some sort of UI in place (change the doc opacity) in case it takes a second for the connection to come back. I don't want people to think they can write because they see content, but it's not quite live, yet. |
|
The error @auniverseaway refers to is adobe/da-collab#76. |
|
I just tested the d&d an image into the page and it works. |
|
ok, the document is reload is because of the 2s second delay (https://github.com/adobe/da-collab/blob/main/src/shareddoc.js#L385-L391) to update the document in admin vs the 1s second delay (https://github.com/adobe/da-collab/blob/main/src/shareddoc.js#L355-L375) to restore from admin if there is some inconsistency. So of course, if the connection is closed before the 2s (i.e. make a change and leave the window), inconsistency is detected when connection is recreated and 1s later, the document is reloaded from admin... +1 to add delay before disconnecting then. |
DA Durable Objects gets a lot of traffic because of da-collab. While I did not manage to see in the logs if this PR has an effect on DO usage, my intuition tells me that if the websocket gets disconnected when the page is not being edited, this should reduce a lot of traffic.
The focus and blur events combined with connect and disconnect works like a charm on Chrome, Safari and Firefox: when leaving the window, disconnect is happening, I see in another editor that user got disconnected and when focusing back in the window, it immediately reconnects and re-sync the file.
To test:
(recreated on new branch with shorter name)