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

REQUEST_OK (0x7) answers PUBLISH, REQUEST_UPDATE, TRACK_STATUS, SUBSCRIBE_NAMESPACE,
SUBSCRIBE_TRACKS and PUBLISH_NAMESPACE. There is one wire type; the per-request-type
names (PUBLISH_OK, TRACK_STATUS_OK, ...) are shorthands for logging, not distinct
messages. SUBSCRIBE_OK (0x4) and FETCH_OK (0x18) do keep bodies of their own.

It carries no Request ID: the request stream it arrives on identifies the request.

## Constructors

### Constructor

> **new RequestOk**(`parameters?`, `trackProperties?`): `RequestOk`

#### Parameters

##### parameters?

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

##### trackProperties?

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

#### Returns

`RequestOk`

## Properties

### parameters

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

***

### trackProperties

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

Track Properties, which the trailing bytes of the payload carry with no
count of their own. Populated only in TRACK_STATUS_OK; empty for every other request
type — see [RequestOk.validateTrackProperties](#validatetrackproperties).

## Methods

### getType()

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

#### Returns

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

***

### serialize()

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

#### Returns

[`FrozenByteBuffer`](FrozenByteBuffer.md)

***

### validateTrackProperties()

> **validateTrackProperties**(`answersTrackStatus`): `void`

Track Properties may only be non-empty when this REQUEST_OK answers a TRACK_STATUS
request (§10.5). A receiver that sees them in any other REQUEST_OK — PUBLISH_OK,
REQUEST_UPDATE_OK, SUBSCRIBE_NAMESPACE_OK or PUBLISH_NAMESPACE_OK — MUST close the
session with a PROTOCOL_VIOLATION.

#### Parameters

##### answersTrackStatus

`boolean`

#### Returns

`void`

#### Throws

:[ProtocolViolationError](ProtocolViolationError.md) If Track Properties are present and this
REQUEST_OK does not answer a TRACK_STATUS.

***

### parsePayload()

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

Parses a REQUEST_OK body. `buf` must hold exactly the payload: whatever follows the
parameters is read as Track Properties, so trailing bytes from a longer buffer would
be parsed as properties.

#### Parameters

##### buf

[`BaseByteBuffer`](BaseByteBuffer.md)

#### Returns

`RequestOk`
