Real-time co-editing: presence and selection events for admins over Mercure
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #560 来自 @silverbackdan —— 已合并
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 20/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
调研方向
Start by reading MercureResourcePublisher and PublishableAwareHub, then trace how the subscriber cookie and private draft updates are created. Check whether draft updates arrive during the module's save behavior, which the payload does not specify. Define and implement the admin presence events, expiry or heartbeat, and rate limits; confirm subscribers are limited to admins and presence works across PHP pods. The linked pull request #560 is already open.
由索引模型根据 Issue 内容生成。
描述
Editors working on the same site at once should see each other: who is editing, which component they've selected, and their changes as they make them. Mercure is already CWA's real-time hub, and the bundle already publishes every write, with a private ?draft=1 update for admins (MercureResourcePublisher, PublishableAwareHub). So co-editing needs a few new events over the same hub, not a new transport.
Companion issues: the module side and the template's TipTap example (linked below once filed).
What the bundle would add
-
Presence events for admins. An endpoint an admin's browser calls to say what they're doing, published as a private update that only admins can receive:
- joined or left a page (route or page IRI);
- selected or deselected a component (component IRI, plus the position IRI so the same component in two places is told apart);
- started or stopped editing a component.
The payload carries the user's id and display name (username, or a name field if the app has one), never the email address.
-
A topic that only admins can subscribe to, using the subscriber cookie the bundle already sets at sign-in and refresh (the JWT
mercure.subscribeclaim). Visitors must never receive presence events. -
Leaving without saying so. A heartbeat, or an expiry on each presence event, so a closed tab or a lost connection drops that editor after a short time.
-
Draft changes as they're saved. Admin edits already save as drafts, and each save already publishes the private draft update. Check that this is enough for another admin's screen to follow along, including while a component is being typed into. If the module saves on a debounce, say what the delay is, so the module can show changes at a sensible rate.
Questions
- Should presence be stored at all (for a "who's here" list on first load), or only published? Publishing only is simpler; a late joiner would see others after their next event or heartbeat.
- Rate limits on the presence endpoint, so a stuck client can't flood the hub.
- Scaled mode: Mercure is one hub (standalone in scaled mode), so presence should work across php pods without anything shared beyond the hub. Confirm.
Out of scope
Two people typing in the same field at the same moment (character-level merging, such as Yjs). The first version can show who's editing and lock or warn on the component someone else is editing.
- 主要语言
- PHP
- 星标
- 32
- 派生
- 8
- 平均合并
- 1 小时 9 分钟
- 30 天内合并 PR
- 163
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
components-web-app/api-components-bundle 的其他 Issue
-
Concurrent writes: optimistic concurrency (version + If-Match → 412) so a co-editor's save is never lost silently可能已有人在做 @silverbackdan 今天认领。 未关闭enhancement
难度 5/5 一周以上 新手友好度 35/100
components-web-app/api-components-bundle#561 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 30/100
components-web-app/api-components-bundle#333 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
components-web-app/api-components-bundle#325 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 52/100
components-web-app/api-components-bundle#259 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
components-web-app/api-components-bundle#186 ·
维护者通常 1 天内回复
查看 components-web-app/api-components-bundle 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 3 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
PHP SDK drops the API path prefix when a custom base URL has no trailing slash可能已有人在做 @Winoren 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
langgenius/dify#44568 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复