Skip to content

Class: SubscribePublication ​

Manages the publication of MOQT objects to a subscriber for a specific track. Handles live object streaming, subscription lifecycle, and stream management.

Constructors ​

Constructor ​

new SubscribePublication(client, track, subscribeMsg, requestStream, largestLocation?): SubscribePublication

Creates a new SubscribePublication instance.

Parameters ​

client ​

MOQtailClient

The MOQT client managing the subscription.

track ​

Track

The track being published.

subscribeMsg ​

Subscribe

The subscribe message containing subscription details.

requestStream ​

RequestStream

The bidi request stream the SUBSCRIBE arrived on. Every message this publication sends back to the subscriber goes on it.

largestLocation? ​

Location

The largest location seen so far, used for determining start location.

Returns ​

SubscribePublication

Properties ​

latestLocation ​

latestLocation: Location | undefined

The latest location that was published to the subscriber.


track ​

readonly track: Track

The track being published.

Methods ​

cancel() ​

cancel(): void

Cancels the publication and cleans up resources. Removes the publication from the client's publication map.

Returns ​

void


done() ​

done(statusCode): Promise<void>

Marks the publication as done and sends a PublishDone message to the client.

Parameters ​

statusCode ​

PublishDoneStatusCode

The status code indicating why the publication ended.

Returns ​

Promise<void>

Throws ​

:InternalError If sending the message fails.


publish() ​

publish(): Promise<void>

Publishes MOQT objects to the subscriber as they become available. Handles stream creation, object writing, and stream closure based on subscription parameters.

Returns ​

Promise<void>

Throws ​

:InternalError If the track does not support live content.


update() ​

update(msg): void

Updates the subscription parameters and locations based on a RequestUpdate message.

Parameters ​

msg ​

RequestUpdate

The update message containing new request details.

Returns ​

void

Throws ​

:InvalidFilterError If the Range Filters the subscription would be left with cannot be applied; nothing is updated.