Skip to content

Comments

Fix MUC room join presence detection (prevents pending messages)#63

Open
phwizard wants to merge 1 commit intodappros:mainfrom
phwizard:fix/muc-presence-join-detection
Open

Fix MUC room join presence detection (prevents pending messages)#63
phwizard wants to merge 1 commit intodappros:mainfrom
phwizard:fix/muc-presence-join-detection

Conversation

@phwizard
Copy link
Contributor

@phwizard phwizard commented Feb 5, 2026

Summary

  • Fixes presenceInRoom() to not rely on the server echoing id=presenceInRoom in presence stanzas.
  • Detects successful MUC join using from=roomJID/resource + MUC <x xmlns=...>, which is consistent with ejabberd and other servers.
  • Avoids rejecting on join timeout (best-effort join), preventing message resend loops that can keep messages stuck as pending.

Why this is needed

In real deployments we observed that the web client can connect (XMPP echo healthcheck OK) but UI never shows the double/green tick for sent messages. In this codebase the tick is driven by whether the message remains in the local heap (pending). When join confirmation fails, the client can hit Only occupants are allowed to send messages to the conference. errors, and the recovery handler repeatedly tries to send presence + (re)join, but join confirmation never arrives because the helper was waiting for an echoed id that ejabberd does not reliably preserve.

This change makes room join detection robust across servers and stops the "presence retry → resend queue → pending forever" failure mode.

Test plan

  • Send a message to a MUC room while connected to ejabberd.
  • Verify that, after a transient "Only occupants…" error, the client successfully rejoins and pending messages flush (double-tick appears).

Notes

Local CI checks in this repo currently fail unrelated to this PR:

  • npm run lint fails because ESLint v9 expects eslint.config.* by default.
  • npm run build:lib fails due to missing react-use-measure during compilation.
    These failures existed before this change; this PR only updates the presence join helper.

Some XMPP servers (incl. ejabberd) do not reliably echo the presence stanza 'id' attribute.
Our join helper waited for id="presenceInRoom" and timed out, causing join retries and
keeping messages stuck as pending (no double-tick/"green ticks") while also triggering
presence resend logic after "Only occupants are allowed" errors.

Detect MUC join presence using from=roomJID/resource + MUC <x xmlns> and avoid rejecting
on timeout (best-effort join), preventing the pending-message loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant