---
url: https://docs.moqtail.dev/ts/api/client/classes/PublishPublication.md
---
# Class: PublishPublication

Manages the proactive publication of MOQT objects from a publisher to the relay.
Handles live object streaming and stream management.

## Constructors

### Constructor

> **new PublishPublication**(`client`, `track`, `publishMsg`): `PublishPublication`

Creates a new PublishPublication instance.

#### Parameters

##### client

[`MOQtailClient`](MOQtailClient.md)

The MOQT client managing the connection.

##### track

[`Track`](../type-aliases/Track.md)

The track being proactively published.

##### publishMsg

[`Publish`](../../model/classes/Publish.md)

The publish message that initiated this session.

#### Returns

`PublishPublication`

## Properties

### latestLocation

> **latestLocation**: [`Location`](../../model/classes/Location.md) | `undefined`

The latest location that was published to the relay.

***

### track

> `readonly` **track**: [`Track`](../type-aliases/Track.md)

The track being proactively published.

## Accessors

### forwarding

#### Get Signature

> **get** **forwarding**(): `boolean`

Whether Objects are being sent right now. False while the peer holds this
publication at FORWARD=0.

##### Returns

`boolean`

***

### streamsOpened

#### Get Signature

> **get** **streamsOpened**(): `bigint`

How many data streams this publication has opened, which is what a PUBLISH_DONE
reports to the subscriber.

##### Returns

`bigint`

## Methods

### cancel()

> **cancel**(): `void`

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

#### Returns

`void`

***

### publishToRelay()

> **publishToRelay**(): `Promise`<`void`>

Publishes MOQT objects to the relay as they become available.
Handles stream creation, object writing, and stream closure.

#### Returns

`Promise`<`void`>

#### Throws

:[InternalError](../../model/classes/InternalError.md) If the track does not support live content.

***

### setForwardState()

> **setForwardState**(`forward`): `void`

Moves the Forward State: false parks the publication, true resumes it. The
application hears about the move through the client's `forwardstatechange` event,
which is where a publisher starts or stops the work behind the track -- a camera
and an encoder cost the same whether or not anything is listening.

#### Parameters

##### forward

`boolean`

#### Returns

`void`

***

### update()

> **update**(`msg`): `void`

Applies a REQUEST_UPDATE the peer sent on this publication's request stream. It
can move the Forward State and the Range Filters; what a publisher sends, and
when, is otherwise its own to decide.

#### Parameters

##### msg

[`RequestUpdate`](../../model/classes/RequestUpdate.md)

#### Returns

`void`

#### Throws

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