Skip to content

Data tracks schema metadata - #1553

Merged
ladvoc merged 68 commits into
mainfrom
ladvoc/schema-metadata
Jun 29, 2026
Merged

Data tracks schema metadata#1553
ladvoc merged 68 commits into
mainfrom
ladvoc/schema-metadata

Conversation

@ladvoc

@ladvoc ladvoc commented May 12, 2026

Copy link
Copy Markdown
Contributor

Closes BOT-318

@changeset-bot

changeset-bot Bot commented May 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5a3a2dd

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

This PR includes changesets to release 2 packages
Name Type
github.com/livekit/protocol Patch
@livekit/protocol 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

@ladvoc
ladvoc requested a review from boks1971 May 12, 2026 19:36
@ladvoc
ladvoc marked this pull request as ready for review May 12, 2026 19:36
@ladvoc
ladvoc requested a review from biglittlebigben May 12, 2026 19:36
Comment thread protobufs/livekit_models.proto Outdated
Comment thread protobufs/livekit_rtc.proto Outdated
@ladvoc
ladvoc force-pushed the ladvoc/schema-metadata branch from f1a3f86 to b16bce9 Compare May 12, 2026 23:57
@ladvoc
ladvoc force-pushed the ladvoc/schema-metadata branch from 897ebab to 61116ab Compare May 13, 2026 00:00

@boks1971 boks1971 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.

Probably hold this till we have some form of implementation?

Should AddDataTrack request fail if there is an existing schema id, but the definition bytes do not match? If so, need to add another error reason for this case.

Should schemas be per publisher? If that is the case, GetSchema should include participant.

If not per publisher, (i. e. per room), becomes trickier to coordinate in a distributed room, so would be good to avoid that.

Comment thread protobufs/livekit_models.proto Outdated
Comment thread protobufs/livekit_rtc.proto Outdated
@ladvoc
ladvoc requested a review from alan-george-lk May 13, 2026 17:51
Comment thread protobufs/livekit_models.proto Outdated
@boks1971

Copy link
Copy Markdown
Contributor

Should AddDataTrack request fail if there is an existing schema id, but the definition bytes do not match? If so, need to add another error reason for this case.

Also a good callout. The question is, is there a real use case where a schema would need to get redefined during the same session? @stephen-derosa, @alan-george-lk what do you think?

since a DataTrack is unique per participant, i would think that we should fail if the same schema id is used but the bytes dont match. This would likely be a an application side error since it means the same participant has two different message definitions for the same id

sounds good. Should add an error reason for this.

@boks1971

Copy link
Copy Markdown
Contributor

If not per publisher, (i. e. per room), becomes trickier to coordinate in a distributed room, so would be good to avoid that.

I see, so, since this will live in an in-memory store and participants can be connected to different nodes, the schema will be stored on the node the publisher is connected to? Therefore, when a GetSchema request is made, the node the requesting participant is connected to may need to make an RPC to the other to get the schema definition. Just want to make sure I have a clear picture here.

Most probably, this will be propagated to other nodes a la DataTrackInfo. The challenge is more on AddDataTrack side. The schema has to be synced to all nodes so that when a publisher adds a schema it can be checked for collisions etc. That leads to races as cross-region sync could race with some other user publishing. So, per publisher makes that simpler as a participant is connected to one node. And GetSchema specifying publisher identity makes it cleaner to lookup the specific publisher.

Still have to think about migration cases, i. e. should clients add the schemas to SyncState?

Comment thread protobufs/livekit_models.proto Outdated
Comment thread protobufs/livekit_models.proto Outdated
ladvoc and others added 2 commits May 20, 2026 09:31
No longer attached to publish request
@ladvoc

ladvoc commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@boks1971, we thought though the edge cases of having schemas being scoped to specific participants and the conclusion is this will work with some minor caveats. Question: should this work based on participant ID or identity for the purposes of the protocol?

@ladvoc
ladvoc force-pushed the ladvoc/schema-metadata branch from d580341 to 63828e9 Compare June 16, 2026 21:48
@ladvoc
ladvoc force-pushed the ladvoc/schema-metadata branch 3 times, most recently from d45ebd1 to bb0475b Compare June 16, 2026 22:42
Comment thread protobufs/livekit_models.proto Outdated
Comment thread protobufs/livekit_models.proto Outdated
Comment thread protobufs/livekit_models.proto Outdated
@ladvoc
ladvoc merged commit 9566433 into main Jun 29, 2026
7 checks passed
@ladvoc
ladvoc deleted the ladvoc/schema-metadata branch June 29, 2026 17:22
@github-actions github-actions Bot mentioned this pull request Jun 29, 2026
ladvoc added a commit to livekit/rust-sdks that referenced this pull request Jul 27, 2026
Adds support for associating schema metadata with a published data track
and storing/retrieving schema definitions.

Schema storage is built on-top of data blobs, a general purpose
mechanism for storing large (in the order of KBs), arbitrary data blobs
in a room:
- Protocol: livekit/protocol#1595
- SFU implementation:
https://github.com/livekit/livekit/tree/raja_async_attributes

Protocol additions for schema metadata:
- livekit/protocol#1553

Closes BOT-368

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
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.

6 participants