Repository navigation
Expose participantIdentity on DataReceivedEvent - #1256
Merged
Merged
Conversation
DataReceivedEvent carries a nullable RemoteParticipant, which is null whenever the sender is not in remoteParticipants - data sent through the Server API, or by a participant that has already left. In that case the receiver had no way at all to tell who sent the data, even though the engine had the identity in hand at the construction site. Add participantIdentity, populated from the data packet for every event. Port of livekit/client-sdk-js#2092. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
xianshijing-lk
requested review from
changt,
cloudwebrtc and
hiroshihorie
as code owners
October 23, 2026 22:28
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A required named parameter breaks existing DataReceivedEvent callers and would make this a major release. The engine is the only producer and always passes the identity, so defaulting it keeps the change additive and the patch bump honest. Matches the Android port. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
hiroshihorie
approved these changes
Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of livekit/client-sdk-js#2092.
The gap
DataReceivedEvent.participantis null whenever the sender is not inremoteParticipants. The engine has the sender's identity on the packet but dropped it when building the event, so in that case the receiver could not tell who sent the data.This happens in normal use, not just edge cases:
ParticipantUpdatethat would let the receiver resolve it. livekit/rust-sdks#1574 measured about two seconds on a local server.The fix
Add
participantIdentitytoDataReceivedEvent, filled from the packet for every event, whether or not the sender resolves to aRemoteParticipant. Apps can use it to attribute or buffer data from a sender the room does not know yet.It is empty for data sent through the Server API (
SendDataRequesthas no identity field) and for data sent by hidden participants, because the server clears the identity in both cases.toString()now includes the identity.API
The new constructor parameter defaults to
'', so the constructor stays source compatible and this ships as a patch.Roomis the only producer and always passes the identity. A TODO marks the constructor to become@internal, with the parameterrequired, in the next major release.Verification
test/core/data_received_identity_test.dartdelivers a packet from an identity that is not a room participant and checks thatparticipantis null while the identity still arrives. A second case covers a known participant. Removing the identity from the event inRoommakes both cases fail.