yorkie icon indicating copy to clipboard operation
yorkie copied to clipboard

Introduce broadcast API for event sharing

Open sejongk opened this issue 1 year ago • 7 comments

What would you like to be added: Yorkie presently relies on the Publish-Subscribe model for sharing document and presence events (refer to: pub-sub.md). However, this lacks the capability to extend its scope to encompass additional event types, notably notifications for end users concerning new document updates or comments.

To address this limitation, the introduction of a "broadcast" feature is recommended. This feature would enable users to define and share a wider range of general events beyond the existing document and presence events.

It's also related to #442, which extracts Room from Document and moves Presence from Client to Room.

Why is this needed: Provide a more comprehensive event-sharing mechanism that satisfies various use cases.

sejongk avatar Aug 25 '23 09:08 sejongk

Is this feature replacing the current watch API (pub/sub model)? I want to know further details and implementation for this proposal :)

krapie avatar Aug 26 '23 10:08 krapie

Is this feature replacing the current watch API (pub/sub model)? I want to know further details and implementation for this proposal :)

Thanks for your interest. It won't replace the watch API, but extend the current pub/sub model to accept general events by adding new API. You can find more details in the broadcast docs of Supabase, Liveblocks or Socket.IO.

ref. https://supabase.com/docs/guides/realtime/broadcast

sejongk avatar Aug 28 '23 00:08 sejongk

SDKs:

  • [x] Go SDK: https://github.com/yorkie-team/yorkie/pull/631
  • [ ] JS SDK:
  • [ ] iOS SDK:
  • [ ] Android SDK:

hackerwins avatar Oct 02 '23 11:10 hackerwins

I'll work on the js sdk

blurfx avatar Oct 08 '23 11:10 blurfx

It would be beneficial to allow broadcasts to emit events via REST API. For certain events (such as Refresh Notification), it is more natural for the server to emit the events rather than the client.

Reference: https://liveblocks.io/docs/api-reference/rest-api-endpoints#post-broadcast-event

devleejb avatar Jun 08 '24 12:06 devleejb

Could I give it a try for JS-SDK?

gwbaik9717 avatar Aug 03 '24 10:08 gwbaik9717

Could I give it a try for JS-SDK?

@gwbaik9717 Sure. If you have any questions, feel free to ask.

sejongk avatar Aug 03 '24 12:08 sejongk