---
url: https://docs.moqtail.dev/ts/api/model/classes/PublishNamespace.md
---
# Class: PublishNamespace

Represents a protocol PublishNamespace message, used to announce a track and its parameters.

## Constructors

### Constructor

> **new PublishNamespace**(`requestId`, `trackNamespace`, `parameters`): `PublishNamespace`

Constructs a PublishNamespace message.

#### Parameters

##### requestId

`bigint`

The request ID for this publish namespace message.

##### trackNamespace

[`Tuple`](Tuple.md)

The track namespace as a Tuple.

##### parameters

[`MessageParameter`](../type-aliases/MessageParameter.md)\[]

The list of strongly-typed message parameters for the track.

#### Returns

`PublishNamespace`

## Properties

### parameters

> `readonly` **parameters**: [`MessageParameter`](../type-aliases/MessageParameter.md)\[]

The list of strongly-typed message parameters for the track.

***

### requestId

> `readonly` **requestId**: `bigint`

The request ID for this publish namespace message.

***

### trackNamespace

> `readonly` **trackNamespace**: [`Tuple`](Tuple.md)

The track namespace as a Tuple.

## Methods

### getType()

> **getType**(): [`ControlMessageType`](../enumerations/ControlMessageType.md)

Gets the message type for this PublishNamespace message.

#### Returns

[`ControlMessageType`](../enumerations/ControlMessageType.md)

The ControlMessageType.PublishNamespace value.

***

### serialize()

> **serialize**(): [`FrozenByteBuffer`](FrozenByteBuffer.md)

Serializes the PublishNamespace message into a [FrozenByteBuffer](FrozenByteBuffer.md).

#### Returns

[`FrozenByteBuffer`](FrozenByteBuffer.md)

The serialized buffer.

#### Throws

:[LengthExceedsMaxError](LengthExceedsMaxError.md) If the payload exceeds 65535 bytes.

***

### parsePayload()

> `static` **parsePayload**(`buf`): `PublishNamespace`

Parses a PublishNamespace message from the given buffer.

#### Parameters

##### buf

[`BaseByteBuffer`](BaseByteBuffer.md)

The buffer to parse from.

#### Returns

`PublishNamespace`

The parsed PublishNamespace message.

#### Throws

:[NotEnoughBytesError](NotEnoughBytesError.md) If the buffer does not contain enough bytes.
