Skip to content

fix: ensure buffered events are flushed on signal reconnection - #2043

Merged
lukasIO merged 6 commits into
mainfrom
lukas/e2ee-setup-fix
Aug 13, 2026
Merged

fix: ensure buffered events are flushed on signal reconnection#2043
lukasIO merged 6 commits into
mainfrom
lukas/e2ee-setup-fix

Conversation

@lukasIO

@lukasIO lukasIO commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@changeset-bot

changeset-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3602f15

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

This PR includes changesets to release 1 package
Name Type
livekit-client 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

Comment thread src/room/Room.ts Outdated
ParticipantEvent.TrackUnsubscribed,
(track: RemoteTrack, publication: RemoteTrackPublication) => {
this.emit(RoomEvent.TrackUnsubscribed, track, publication, participant);
this.emitWhenConnected(RoomEvent.TrackUnsubscribed, track, publication, participant);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was asymmetric before wrt TrackSubscribed. Now both events are buffered when not connected

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, that makes sense, do we need to use emitWhenConnected for other events as well ?and does emitWhenConnected make sure all the events will be emitted in the right orders ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to revert this, as it was leading to the events getting lost during teardown.
There's still a test in #2044 that ensures correct behaviour here

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 105.28 KB (-0.04% 🔽)
dist/livekit-client.umd.js 114.42 KB (+0.06% 🔺)

Comment thread src/room/Room.ts
this.emitBufferedEvents();
})
.on(EngineEvent.SignalResumed, () => {
this.bufferedEvents = [];

@lukasIO lukasIO Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the main bug. The buffered events should not have been cleared on SignalResumed.

Instead we're now flushing them

@lukasIO
lukasIO marked this pull request as ready for review August 13, 2026 10:20

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread src/room/Room.ts Outdated
Comment thread src/room/Room.ts Outdated
@lukasIO
lukasIO merged commit b6615cd into main Aug 13, 2026
6 checks passed
@lukasIO
lukasIO deleted the lukas/e2ee-setup-fix branch August 13, 2026 13:40
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.

2 participants