Skip to content

Data track schema metadata - #1994

Open
ladvoc wants to merge 11 commits into
mainfrom
ladvoc/schema-metadata
Open

Data track schema metadata#1994
ladvoc wants to merge 11 commits into
mainfrom
ladvoc/schema-metadata

Conversation

@ladvoc

@ladvoc ladvoc commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Adds support for attaching schema metadata to data tracks mirroring the implementation in livekit/rust-sdks#1159.

Usage:

// Publish
const track = await room.localParticipant.publishDataTrack({
  name: 'my_sensor_data',
  schema: { name: 'rgb', encoding: 'protobuf' },
  frameEncoding: 'protobuf',
});

// Subscribe
room.on(RoomEvent.DataTrackPublished, (track) => {
  console.log(track.info.schema);         // { name: 'rgb', encoding: 'protobuf' }
  console.log(track.info.frameEncoding);  // 'protobuf'
});

Note: the scope of this PR has been limited to exposing schema metadata fields; schema storage will be added in a follow-up.

Areas for reviewers to scrutinize:

  • Convention for Protobuf conversion

Closes BOT-441

@changeset-bot

changeset-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: cf53042

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
dist/livekit-client.esm.mjs 106.13 KB (+0.81% 🔺)
dist/livekit-client.umd.js 115.17 KB (+0.66% 🔺)

@1egoman 1egoman 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.

Generally looks good to me!

Comment thread src/room/data-track/outgoing/OutgoingDataTrackManager.test.ts
Comment thread src/room/data-track/schema.test.ts Outdated
Comment on lines +135 to +139

export const DataTrackSchemaEncoding = {
from(protocol: ProtocolDataTrackSchemaEncoding): DataTrackSchemaEncoding {
switch (protocol.value.case) {
case 'wellKnown':

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.

thought: I'm a big fan of this pattern where you have a type and value which share the same name, and typescript merges them into one identifier which can be used in either context. However, @lukasIO has raised in the past this can be somewhat confusing if you don't understand what is going on.

I'll let him weigh in but I'm fine with this as is especially since it's not directly part of the external interface.

Comment thread src/room/data-track/schema.ts
Comment thread src/room/data-track/schema.ts Outdated
Comment thread src/room/data-track/types.ts Outdated
Comment thread src/room/data-track/outgoing/types.ts
@1egoman

1egoman commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Longer term, I want to discuss how to get this using the Serializer type but I think that can wait until schema related serialization / deserialization is being done in other sdks. And I don't think the migration path to that would be too crazy.

@ladvoc
ladvoc marked this pull request as ready for review July 9, 2026 21:02

@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: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@ladvoc
ladvoc force-pushed the ladvoc/schema-metadata branch from 7adb080 to c73d752 Compare August 13, 2026 17:05
@ladvoc
ladvoc force-pushed the ladvoc/schema-metadata branch from 5a5ca13 to cf53042 Compare August 13, 2026 21:00
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