Skip to content

core: rtcstats sends a room's teardown events with the next room's session - #1193

Open
misi-whereby wants to merge 3 commits into
mainfrom
misi/cob-3439-rtcstats-loses-the-room-teardown-events-and
Open

misi-whereby wants to merge 3 commits into
mainfrom
misi/cob-3439-rtcstats-loses-the-room-teardown-events-and

Conversation

@misi-whereby

@misi-whereby misi-whereby commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

Summary:
rtcstats sends a room's teardown events with the next room's session

Related Issue:

Testing

Join a group (SFU) room, wait ~15 s, click "Leave room", then "Re-join"
It will create 2 rtcstats session.
After the fix expected: ["close","PC_2"…] and ["close","PC_3"…] in the rtcstats first session not in the second.

Screenshots/GIFs (if applicable)

Checklist

  • My code follows the project's coding standards.
  • Prefixed the PR title and commit messages with the service or package name
  • I have written unit tests (if applicable).
  • I have updated the documentation (if applicable).
  • By submitting this pull request, I confirm that my contribution is made
    under the terms of the MIT license.

Additional Information

@changeset-bot

changeset-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4904291

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@whereby.com/core Patch
@whereby.com/media Minor
@whereby.com/assistant-sdk Patch
@whereby.com/browser-sdk Patch
@whereby.com/react-native-sdk Patch
@whereby.com/audio-denoiser Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@misi-whereby misi-whereby changed the title core: rtcstats loses the room teardown events and P2P can close the next room's connection core: rtcstats sends a room's teardown events with the next room's session Nov 11, 2026
@misi-whereby
misi-whereby marked this pull request as ready for review November 11, 2026 09:19
@misi-whereby
misi-whereby force-pushed the misi/cob-3439-rtcstats-loses-the-room-teardown-events-and branch 3 times, most recently from ab00f63 to 27ea864 Compare November 11, 2026 15:27
@misi-whereby
misi-whereby requested a review from a team November 11, 2026 19:03
@misi-whereby
misi-whereby force-pushed the misi/cob-3439-rtcstats-loses-the-room-teardown-events-and branch 4 times, most recently from 1efd0ec to e151256 Compare November 13, 2026 10:01
rtcstats connects with the page's path, and the server uses it as the room
name. The server also uses the Origin header for the subdomain, and both in
the stored file name. On a page that isn't the room's page, these are the
page's, and a page can't set the Origin header.

setRoomUrl() takes the room's origin and path: the connection then uses an
empty path, so the page's path isn't sent, and the room's origin and path
are sent in the roomUrl query parameter, for a server that reads it. It's
used from the next connection. Without it, the URL is the same as before.

After requireRoomUrl(), rtcstats doesn't connect while the room's URL isn't
set, so the page's origin and path are never sent.
rtcstats uses the page's path as the room name, and the page's origin for
the subdomain, and both in the stored file name. Core doesn't run on the
room's page, so it gives rtcstats the room's origin and path when the app
starts, and clears them when the app stops. The room URL's query isn't
passed on, as it can hold a room key.
rtcstats was closed on doAppStop, before doDisconnectRtc tore down the
peer connections. The teardown's events were then buffered and sent with
the next room's rtcstats session.

doDisconnectRtc now closes rtcstats after disconnectAll(), so these events
are sent to the room they belong to.
@misi-whereby
misi-whereby force-pushed the misi/cob-3439-rtcstats-loses-the-room-teardown-events-and branch from e151256 to 4904291 Compare November 17, 2026 10:39
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