Type Alias: SwitchOptions
SwitchOptions =
object
Parameters for switching an existing SUBSCRIBE to a new track.
Example
Switching a subscription to a new track
ts
await client.switch({
switchFromRequestId,
switchMode: SwitchMode.Soft,
newSubscribeOptions: {
fullTrackName: newFullTrackName,
priority: 0,
groupOrder: GroupOrder.Original,
locationFilter: new LocationFilter(LocationFilterType.NextObject)
}
})Properties
newSubscribeOptions
newSubscribeOptions:
Omit<SubscribeOptions,"forward">
New subscription options to switch to. No forward: the relay controls forwarding during a switch.
onDrainDecision?
optionalonDrainDecision?: (request) =>boolean
Called for each object of a superseded subscription that a soft switch left draining. Returning false ends the drain: that subscription is retired and the new track's objects, held until then, are released.
Parameters
request
Returns
boolean
switchFromRequestId
switchFromRequestId:
bigint
The original SUBSCRIBE request id (bigint) being switched from.
switchMode
switchMode:
SwitchMode
SwitchMode controlling how the switch is applied.