Repository navigation
Expose participantIdentity on RoomEvent.DataReceived - #1046
Open
xianshijing-lk wants to merge 2 commits into
Open
xianshijing-lk wants to merge 2 commits into
xianshijing-lk wants to merge 2 commits into
Conversation
DataReceived carries a nullable RemoteParticipant, which is null whenever the sender is not in the room - data sent through the Server API, or by a participant that has already left. In that case the receiver had no way to tell who sent the data. The identity was discarded before the event was built: the engine passed only the inner UserPacket to onUserPacket, while the authoritative participantIdentity lives on the enclosing DataPacket. Forward it through the listener and report it on every DataReceived event. Port of livekit/client-sdk-js#2092. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
xianshijing-lk
requested review from
MaxHeimbrock and
davidliu
as code owners
October 23, 2026 22:31
🦋 Changeset detectedLatest commit: 7f191c2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
…field Addresses review feedback: - A Kotlin default argument emits the full-arity constructor plus a synthetic one, so the previous five-argument JVM signature would have disappeared and modules compiled against an earlier SDK would fail to link. Add an explicit five-argument secondary constructor. - AGENTS.md asks for a short example with a new public API, so show attributing data when `participant` is null. - Update the copyright year range that spotless requires. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Diffuse output: AARJAR |
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
RoomEvent.DataReceived.participantis nullable and is null whenever the sender is not in the room — data sent through the Server API, or by a participant who has already left. In that case the receiver cannot tell who sent the data at all; the identity is absent from the event.Unlike the JS and Flutter SDKs, the identity was not merely unused here — it was discarded one layer earlier.
RTCEngineunwraps theDataPacketand hands the listener only the innerUserPacket:The authoritative
participantIdentitylives on the enclosingdp, soRoom.onUserPacketnever saw it and had nothing to put on the event.The fix
Forward
dp.participantIdentitythrough the internalRTCEngine.Listener.onUserPacketand surface it asDataReceived.participantIdentity, populated whether or not the sender resolves to aRemoteParticipant.Verification
Added
dataReceivedReportsSenderIdentityWithoutParticipanttoRoomDataMockE2ETest, delivering a packet whose sender is not a room participant and assertingparticipantis null while the identity still arrives. Before the change it does not compile, since the field does not exist.:livekit-android-test:testReleaseUnitTestgreen (both cases in that file run).API notes
participantIdentityis added as a constructor parameter with a""default, so existing construction sites keep compiling.RTCEngine.Listener.onUserPacketgains a parameter. That interface is internal to the SDK andRoomis its only implementor, so no public surface changes there.Unrelated observation
While tracing this I noticed
Room.onUserPacketresolves the sender withgetParticipantBySid(packet.participantSid)— the inner packet's SID — whereas the JS and Flutter SDKs resolve by the outer packet's identity. Now that the identity is plumbed through, switching the lookup to it would also be possible. I have left the lookup alone here to keep this change focused; happy to file it separately if it's worth pursuing.🤖 Generated with Claude Code