Skip to content

Conversation

@benglewis
Copy link

@benglewis benglewis commented Dec 20, 2023

  • Allow users to debounce their updates to the server (the client accumulates the updates and merges them before syncing at the interval), merging the Y.js updates into a single update over that given period, also to be able to notify users that their updates were not synced to the server.
  • Allow users to debounce their awareness updates to the server (sending an update once every given time to the server)

Notes on debouncing:

  • The deboucing allow users to specify the time over which to delay, i.e. the debounce time, but also a max wait to ensure that updates on content changes and awareness are sent at least once every n time
  • I provide an onPending function which is used to indicate that there is local debounced data which has not yet been sent (i.e. changes which have not yet "been saved")
  • Added a localOnly flag to use .local on Socket.IO to only broadcast to local sockets, even when using an adapter for document updates, since those updates would need to be applied via some other mechanism anyway to synchronize the content between the servers (since the y.js document is stateful, and not synchronizing the server instances causes them to essentially fail)
  • Added a timeoutForAck argument to specify the timeout for the first "sync-step-1" since it can fail (i.e. not receive an acknowledgement) and so I added a log for such a case
  • I fixed the type annotation for the handshake for the authenticate argument

benglewis and others added 9 commits December 18, 2023 19:21
Make debounced awareness run at least once per maxWaitForDebouncingAwareness
Make debounced updates run at least once per maxWaitForDebouncingUpdates
These flags are used on the server-side.
`localOnly` uses the `.local` feature on socket.io (which useful when synchronizing via another channel, e.g. Redis pub / sub, between servers, which is necessary anyway to ensure the server state is synchronized properly)
`timeoutForAck` determines the timeout for the "sync-step-1" event
Added error handling to failed acknowledgement for "sync-step-1"
@benglewis benglewis marked this pull request as ready for review December 28, 2023 17:49
@benglewis
Copy link
Author

@ivan-topp Is this something that you think that you may merge?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant