yorkie-js-sdk icon indicating copy to clipboard operation
yorkie-js-sdk copied to clipboard

Remove Client.subscribe

Open hackerwins opened this issue 1 year ago • 2 comments

Description:

The current implementation of Document.subscribe provides sufficient event support corresponding to Channel or Room. To simplify the usage of the Client as a simple Connection object, the Client.subscribe method should be removed.

Why:

Removing Client.subscribe, the system can be streamlined for better usability and consistent functionality.

hackerwins avatar Apr 25 '24 01:04 hackerwins

The current ClientEvent includes four events: StatusChangedEvent, DocumentChangedEvent, StreamConnectionStatusChangedEvent, and DocumentSyncedEvent. Upon reconsideration, it appears some places may still require these events. What do you think about the following modifications?

  • StatusChangedEvent = activated | deactivated
    • Since it's not being used, it can be removed for now and added back when needed.
  • DocumentChangedEvent
    • This event can be used to detect changes in the document when performing manual sync. It can be moved to document.subscribe().
  • StreamConnectionStatusChangedEvent = connected | disconnected
    • Since the watch stream is established for each document, it can be moved to document.subscribe().
  • DocumentSyncedEvent = synced | sync-failed
    • It can be moved to document.subscribe().

chacha912 avatar Apr 25 '24 02:04 chacha912

Thank you for the detailed investigation. Since there is currently no use case for Client.Subscribe, it may be a good idea to remove it and add it later as needed.

hackerwins avatar Apr 25 '24 02:04 hackerwins