Create a LocalDataTrack for sending arbitrary string or binary messages. The track defaults to reliable, ordered delivery; pass maxRetransmits or maxPacketLifeTime to make it unreliable.
maxRetransmits
maxPacketLifeTime
A track name, or a LocalDataTrackOptions object.
The created LocalDataTrack.
If options is not a string or object, if name is not a non-empty string, or if ordered is not a boolean.
options
name
ordered
If both maxRetransmits and maxPacketLifeTime are set.
If either maxRetransmits or maxPacketLifeTime is not an integer in [0, 65535].
// Reliable, ordered messaging.const dataTrack = createLocalDataTrack('chat');room.localParticipant.publishTrack(dataTrack);dataTrack.send('hello'); Copy
// Reliable, ordered messaging.const dataTrack = createLocalDataTrack('chat');room.localParticipant.publishTrack(dataTrack);dataTrack.send('hello');
// Unreliable, time-bounded delivery.const dataTrack = createLocalDataTrack({ name: 'telemetry', maxPacketLifeTime: 1000 }); Copy
// Unreliable, time-bounded delivery.const dataTrack = createLocalDataTrack({ name: 'telemetry', maxPacketLifeTime: 1000 });
Create a LocalDataTrack for sending arbitrary string or binary messages. The track defaults to reliable, ordered delivery; pass
maxRetransmitsormaxPacketLifeTimeto make it unreliable.