Skip to content

Data track integration#1820

Draft
1egoman wants to merge 81 commits intomainfrom
data-track-integration
Draft

Data track integration#1820
1egoman wants to merge 81 commits intomainfrom
data-track-integration

Conversation

@1egoman
Copy link
Contributor

@1egoman 1egoman commented Feb 20, 2026

Integrates the data track managers (both incoming and outgoing) into the existing sdk Room and RemoteParticipant interfaces. Once this is merged, data tracks is fully implemented!

NOTE: This pull request is based on top of the data-track-incoming-manager branch and the diff will be weird until that one is merged here.

Interface - Publishing

const localDataTrack = await room.publishDataTrack({name: "data track name"});
await localDataTrack.tryPush(new Uint8Array(/* ... */));

// Once you are done with the local data track, it can be unpublished:
await localDataTrack.unpublish();

Interface - Subscribing

// There are two ways to get a remote data track, either a room event:
room.on(RoomEvent.RemoteDataTrackPublished, async (remoteDataTrack) => {
  // ...
});

// Or a new field on `RemoteParticipant`:
const remoteDataTrack = remoteParticipant.dataTracks.get("track name"); // Get a data track which has been published
const remoteDataTrack = await remoteParticipant.dataTracks.waitUntilExists("track name"); // Get a data track which _will_ be published shortly

// Either way, once you have a remoteDataTrack, you can subscribe:
const stream = await remoteDataTrack.subscribe(/* optional abort signal */);
for await (const frame of stream) {
  console.log(`Received bytes from ${remoteDataTrack.info.name}:`, frame.payload);
}

Todo:

…in Throws wherever possible

This is a LOT cleaner!
1egoman added 26 commits March 5, 2026 15:01
Temporarily replace the hexdump with a chart for a demo. I think this
probably should be reverted though, the hexdump is more useful longer
term.
…ks data channel

Adds a "sendLossyBytes" method which hooks into the existing data
channel logging / buffer status / etc infrastructure.
this.localParticipant = new LocalParticipant(...) takes the outgoing
data track manager, which needs the e2ee manager, and the e2ee manager
can only be constructed if this.localParticipant is set.
Been writing a little too much rust lately...
@1egoman 1egoman force-pushed the data-track-integration branch from 6a5960d to 2e6f8cf Compare March 5, 2026 20:51
@1egoman 1egoman changed the title (WIP) Data track integration Data track integration Mar 5, 2026
@ladvoc ladvoc self-requested a review March 6, 2026 22:09
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.

1 participant