yorkie
yorkie copied to clipboard
Introduce broadcast API for event sharing
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.
Is this feature replacing the current watch API (pub/sub model)? I want to know further details and implementation for this proposal :)
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
SDKs:
- [x] Go SDK: https://github.com/yorkie-team/yorkie/pull/631
- [ ] JS SDK:
- [ ] iOS SDK:
- [ ] Android SDK:
I'll work on the js sdk
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
Could I give it a try for JS-SDK?
Could I give it a try for JS-SDK?
@gwbaik9717 Sure. If you have any questions, feel free to ask.