Skip to content

Collaboration edge is only exposed to PHP, so the client cannot act on it #451

Closed

Description

@josephfusco

wp_presence_check_collaboration_threshold() fires wp_presence_collaboration_started and _ended on the 1 to 2+ and 2+ to 1 edges. Both are PHP actions. The editor heartbeat calls it at heartbeat.php:334 and then returns $response unchanged, so a browser has no way to learn the edge without polling something.

That makes the signal unusable for the case it exists for: letting the block editor decide whether to start the sync loop. Gutenberg derives hasCollaborators from its own poll response today, so a solo editor pays ~840 requests an hour to discover nobody else is there.

Done when

  • The editor heartbeat response carries the current editor count for the room
  • wp_presence_check_collaboration_threshold() returns the count instead of void
  • The new key is in RELAYED_TICK_KEYS (assets/js/presence-ping.js), or a coalesced sibling tab never receives it
  • No filter on the key. None of the existing response keys has one, and perf: skip presence writes that would only move the timestamp #450 records the argument against adding filters that become commitments
  • Tests cover the key's presence on the editor screen and its absence elsewhere

Shape

Handler wp_presence_editor_heartbeat_received(), includes/heartbeat.php:288
Precedent for setting a key includes/debugger-widget.php:115
Proposed key presence-heartbeat-collaborators
Return change wp_presence_check_collaboration_threshold() void to int, back compatible

Part of #444, section 6. Prerequisite for deferring the Gutenberg poll loop until a second person arrives.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Used for: Assisting with drafting this issue.

Activity

  1. added
    [Type] Enhancement
    [Area] Heartbeat 💓
    php
    javascript
    Public API
    on Sep 2, 2026
  2. josephfusco commented on Sep 2, 2026

    @josephfusco
    CollaboratorAuthor

    Hey @theaminulai, please comment on the issue you want so a maintainer can assign it. GitHub only allows assignment to people who have commented. This helps avoid duplicating work.

    https://github.com/WordPress/presence-api/blob/main/.github/CONTRIBUTING.md#claiming-an-issue

  3. theaminulai commented on Sep 2, 2026

    @theaminulai
    Member

    I’d like to work on this issue. Please assign it to me. @josephfusco Thanks!

  4. added this to the n.e.x.t milestone on Sep 4, 2026
  5. josephfusco commented on Sep 9, 2026

    @josephfusco
    CollaboratorAuthor

    Closing — #454 already covered all five items above.

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

Metadata

Metadata

Assignees

Labels

Public API[Area] Heartbeat 💓[Type] Enhancementjavascriptphp

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions