Skip to content

Class: SubscribeRequest ​

Represents an active subscription request in MOQT, implementing PromiseLike for convenient async resolution when subscription setup succeeds or fails.

Implements ​

Constructors ​

Constructor ​

new SubscribeRequest(msg): SubscribeRequest

Parameters ​

msg ​

Subscribe

Returns ​

SubscribeRequest

Properties ​

done ​

readonly done: Promise<PublishDone | undefined>

Resolves once this request is over, with SubscribeRequest.publishDone. Never rejects.


earlyDiscardPolicy ​

earlyDiscardPolicy: EarlyDiscardPolicyConfig | undefined


endGroup ​

endGroup: bigint | undefined


expectedStreams ​

expectedStreams: bigint | undefined


expires ​

expires: bigint | undefined

EXPIRES from the last SUBSCRIBE_OK or REQUEST_UPDATE_OK, in milliseconds.


fillBoundary ​

fillBoundary: Location | undefined

The publisher's Largest Object as of the last SUBSCRIBE_OK or REQUEST_UPDATE_OK, which is where a fill fetch stream stops.


fillOpened ​

fillOpened: boolean = false

A fill fetch stream opened for this subscription.


forward ​

forward: boolean


fullTrackName ​

fullTrackName: FullTrackName


isCanceled ​

isCanceled: boolean = false


largestLocation ​

largestLocation: Location | undefined


manager ​

manager: Subscription

The Subscription that owns this request's consumer stream; it sets itself on construction.


objects ​

readonly objects: ObjectStream


onEndOfRange ​

onEndOfRange: EndOfRangeHandler | undefined


openFills ​

openFills: number = 0

Fill fetch streams still delivering.


orderer ​

orderer: ObjectOrderer | undefined


priority ​

priority: number


publishDone ​

publishDone: PublishDone | undefined

The last PUBLISH_DONE received for this request.


requestId ​

requestId: bigint


startLocation ​

startLocation: Location | undefined


stream ​

readonly stream: ReadableStream<MoqtObject>


streamsAccepted ​

streamsAccepted: bigint = 0n


subscribeParameters ​

subscribeParameters: MessageParameter[]

Methods ​

catch() ​

catch<TResult>(onrejected?): Promise<SubscribeOk | RequestError | TResult>

Type Parameters ​

TResult ​

TResult = never

Parameters ​

onrejected? ​

((reason) => TResult | PromiseLike<TResult>) | null

Returns ​

Promise<SubscribeOk | RequestError | TResult>


enqueue() ​

enqueue(obj, previous?): void

Puts an object on the consumer stream, through SubscribeRequest.orderer when there is one. previous is the object before it on the same fill fetch stream.

Parameters ​

obj ​

MoqtObject

previous? ​

Location

Returns ​

void


finally() ​

finally(onfinally?): Promise<SubscribeOk | RequestError>

Parameters ​

onfinally? ​

(() => void) | null

Returns ​

Promise<SubscribeOk | RequestError>


finish() ​

finish(): void

Ends the request: resolves SubscribeRequest.done. Later calls do nothing.

Returns ​

void


output() ​

output(obj): void

Writes an object the orderer released, or an unordered one, through the manager.

Parameters ​

obj ​

MoqtObject

Returns ​

void


reject() ​

reject(reason?): void

Rejects the internal promise with an error/reason.

Parameters ​

reason? ​

any

Returns ​

void


resolve() ​

resolve(value): void

Resolves the internal promise with a SubscribeOk or RequestError.

Parameters ​

value ​

SubscribeOk | RequestError | PromiseLike<SubscribeOk | RequestError>

Returns ​

void


then() ​

then<TResult1, TResult2>(onfulfilled?, onrejected?): PromiseLike<TResult1 | TResult2>

Attaches callbacks for the resolution and/or rejection of the Promise.

Type Parameters ​

TResult1 ​

TResult1 = SubscribeOk | RequestError

TResult2 ​

TResult2 = never

Parameters ​

onfulfilled? ​

((value) => TResult1 | PromiseLike<TResult1>) | null

The callback to execute when the Promise is resolved.

onrejected? ​

((reason) => TResult2 | PromiseLike<TResult2>) | null

The callback to execute when the Promise is rejected.

Returns ​

PromiseLike<TResult1 | TResult2>

A Promise for the completion of which ever callback is executed.

Implementation of ​

PromiseLike.then


unsubscribe() ​

unsubscribe(): void

Marks this subscription request as canceled.

Returns ​

void


update() ​

update(msg): void

Updates subscription parameters in-place when a RequestUpdate message is received.

Parameters ​

msg ​

RequestUpdate

Returns ​

void