Skip to content

core: Don't send unchanged object values to rtcstats again - #1197

Open
misi-whereby wants to merge 7 commits into
mainfrom
misi/cob-3441-rtcstats-re-sends-unchanged-object-values
Open

misi-whereby wants to merge 7 commits into
mainfrom
misi/cob-3441-rtcstats-re-sends-unchanged-object-values

Conversation

@misi-whereby

Copy link
Copy Markdown
Contributor

Description

Summary:
Don't send unchanged object values to rtcstats again

Related Issue:

Testing

Join any room
Open rtcstats Messages, filter on "recording":
At startup with {"local":false,"cloud":false}.
Join the same room from a second tan then leave; repeat 2–3 times.
Without the fix: on the first client rtcstat one more "recording" frame with the same {"local":false,"cloud":false} on every join, although nothing changed.

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: 8729ad8

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 requested a review from a team November 11, 2026 19:02
@misi-whereby
misi-whereby force-pushed the misi/cob-3441-rtcstats-re-sends-unchanged-object-values branch 3 times, most recently from d7ad22c to a5d97f1 Compare November 13, 2026 08: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.
No behaviour change. doRtcAnalyticsCustomEventsInitialize and the action
listener had their own copies of the compare, send and mark logic. Both
now use sendIfChanged, which the next commit also uses from reactors.
clientId, deviceId, externalId, organizationId, signalConnectionStatus,
rtcConnectionStatus and userRole were only sent by
doRtcAnalyticsCustomEventsInitialize, when the RtcManager is initialized.
Later changes, such as a signal disconnect or reconnect, weren't sent
unless another RtcManager was initialized. Each is now also sent when its
value changes.

Values are only sent once the RtcManager is initialized.
doRtcAnalyticsCustomEventsInitialize runs then and sends insightsStats
first, which rtcstats uses to set the session's timestamp. Checking only
that an RtcManager existed wasn't enough: rtcManagerCreated sets the
RtcManager and status "ready" in the same action, before the
initialization. Values that change before it are left unmarked, and the
initialization sends their current value.
Sent when the RtcManager is initialized and whenever the mode changes.
rtcstats reads the userRole event's value from its role property, both
for the stored session info and for insights. It was sent as userRole,
so the role was never recorded.
A value is sent when makeComparable(value), a JSON string for objects,
differs from the last reported value, but the raw value was stored as the
last reported one. For objects and null the two never match, so those
events were sent again on every action that triggers them, even when they
hadn't changed, for example recording on every newClient. Store the
comparable value instead.
@misi-whereby
misi-whereby force-pushed the misi/cob-3441-rtcstats-re-sends-unchanged-object-values branch from a5d97f1 to 8729ad8 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