# Universal events

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

Universal events are required for all RTMS implementations. They handle the connection handshake protocol, keep-alive operations, session and stream state management, and media data delivery.

> Use these events with the product-specific events for your implementation. For Meetings, Webinars, or Video SDK, see [Session events](/docs/rtms/event-reference/session-events/). For Contact Center, see [Contact Center events](/docs/rtms/event-reference/contact-center-events/).

## Message transmission channels

RTMS events are transmitted through two connection types established during the handshake process.

| Signaling connection                                                                                                                                                                                                                                                                                                                                                                               | Media connection                                                                                                |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `SIGNALING_HAND_SHAKE_REQ``SIGNALING_HAND_SHAKE_RESP``DATA_HAND_SHAKE_REQ``DATA_HAND_SHAKE_RESP``EVENT_SUBSCRIPTION``EVENT_UPDATE``CLIENT_READY_ACK``STREAM_STATE_UPDATE``SESSION_STATE_UPDATE``SESSION_STATE_REQ``SESSION_STATE_RESP``KEEP_ALIVE_REQ``KEEP_ALIVE_RESP``STREAM_STATE_REQ``STREAM_STATE_RESP``STREAM_CLOSE_REQ``STREAM_CLOSE_RESP``VIDEO_SUBSCRIPTION_REQ``VIDEO_SUBSCRIPTION_RESP` | `KEEP_ALIVE_RESP``MEDIA_DATA_AUDIO``MEDIA_DATA_VIDEO``MEDIA_DATA_SHARE``MEDIA_DATA_TRANSCRIPT``MEDIA_DATA_CHAT` |

> The examples on this page use meeting-specific values (such as `meeting_uuid` and `meeting.rtms_started`), but the message structure is the same across all RTMS-supported products.

Both the signaling and media connections are WebSocket connections. They must use TLS 1.2 or 1.3. For details, see [TLS requirements](/docs/rtms/event-reference/universal-events/#tls-requirements).

## TLS requirements

RTMS requires TLS 1.2 or 1.3 on all WebSocket connections across all products. Connections that use an older TLS version are rejected during the TLS handshake. The requirement applies only to WebSocket connections. SRT media streams aren't affected.

Make sure your connection requests use TLS 1.2 or 1.3.

### Supported cipher suites

These cipher suites are supported for each TLS version.

**TLS 1.2**

```
ECDHE-RSA-AES256-GCM-SHA384
DHE-RSA-AES256-GCM-SHA384
ECDHE-RSA-CHACHA20-POLY1305
DHE-RSA-CHACHA20-POLY1305
ECDHE-RSA-AES128-GCM-SHA256
DHE-RSA-AES128-GCM-SHA256
```

**TLS 1.3**

```
TLS_AES_256_GCM_SHA384
TLS_AES_128_GCM_SHA256
TLS_CHACHA20_POLY1305_SHA256
```

## Protocol versions

The signaling handshake selects the protocol version for the stream. The media (data) handshake uses the version that the signaling handshake selected. Signaling and data connections must use the same message format.

| Signaling request                       | Selected version |
| --------------------------------------- | ---------------- |
| `protocol_version` missing or below `2` | V1               |
| `protocol_version` `2` or higher        | V2               |

The following table compares the features available in each version. A dash (—) means the version doesn't support the feature.

| Feature                            | V1                                | V2                                                     |
| ---------------------------------- | --------------------------------- | ------------------------------------------------------ |
| Event identifier                   | `event_type`                      | `event_code`                                           |
| Protobuf framing                   | —                                 | Available                                              |
| `media_type` `32` (all)            | Permitted                         | Rejected with status `48`                              |
| Multiple individual video          | Requires V2, response status `49` | Available when enabled                                 |
| SRT passphrase                     | —                                 | Returned when an SRT URL is configured                 |
| Payload encryption                 | —                                 | Negotiated with `payload_encryptions`                  |
| Payload key mode                   | —                                 | `1` per-media derived (default), `2` direct master key |
| Video and screen share codec `PNG` | Available                         | Not available. Use `JPG` or `H.264`.                   |

SRT transport and application-layer payload encryption are independent. A V2 response can include an SRT passphrase with payload encryption disabled, or enable payload encryption without an SRT endpoint.

## Signaling handshake request

<span className="pill_signaling">Sent to the signaling connection</span>

Send a signed handshake request to the `server_urls` provided in the `meeting.rtms_started` event, also known as the signaling connection. Use your app credentials with the session details to generate the signature. For more information, see [App establishes signaling connection](/docs/rtms/event-reference/).

> Use `meeting.rtms_started` and `meeting.rtms_stopped` events in the [Webhook reference](/docs/api/rtms/events) to get initial session details like the `meeting_uuid` and `rtms_stream_id`.

```json
{
    "msg_type": 1,
    "protocol_version": 2,
    "sequence": 1,
    "meeting_uuid": "xxxxxxxxxx",
    "rtms_stream_id": "xxxxxxxxxx",
    "signature": "xxxxxxxxxx",
    "buffer_data": false
}
```

To enable payload encryption, add `media_payload_key_mode` and `payload_encryptions`. Each encryption offer includes a PEM-encoded public key.

```json
{
    "msg_type": 1,
    "protocol_version": 2,
    "sequence": 1,
    "meeting_uuid": "xxxxxxxxxx",
    "rtms_stream_id": "xxxxxxxxxx",
    "signature": "xxxxxxxxxx",
    "media_payload_key_mode": 1,
    "payload_encryptions": [
        {
            "key_wrap_algorithm": 10,
            "payload_encryption_algorithm": 1,
            "public_key": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----\n",
            "key_id": "client-key-1"
        }
    ]
}
```

```json
{
    "msg_type": 1,
    "protocol_version": 1,
    "sequence": 1,
    "meeting_uuid": "xxxxxxxxxx",
    "rtms_stream_id": "xxxxxxxxxx",
    "signature": "xxxxxxxxxx",
    "buffer_data": false
}
```

| Field                                                                                                                                                                                                                                     | Type                                    | Description                                                                                                                                                                                                                                  |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`                                                                                                                                                                                                                                | <span class="prop-int">int</span>       | The request from the app to the RTMS server to initiate a handshake. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type).                                                                                |
| `protocol_version`                                                                                                                                                                                                                        | <span class="prop-int">int</span>       | The RTMS protocol version. Missing or below `2` selects V1. `2` or higher selects V2. See [Protocol versions](#protocol-versions).                                                                                                           |
| `sequence`                                                                                                                                                                                                                                | <span class="prop-int">int</span>       | The sequence number of the message. Must start at `1`.                                                                                                                                                                                       |
| `meeting_uuid`                                                                                                                                                                                                                            | <span class="prop-string">string</span> | The unique identifier for the session.                                                                                                                                                                                                       |
| `rtms_stream_id`                                                                                                                                                                                                                          | <span class="prop-string">string</span> | The unique identifier of the RTMS stream. Multiple streams are possible for a session if streaming access stops or restarts.                                                                                                                 |
| `signature`                                                                                                                                                                                                                               | <span class="prop-string">string</span> | The authentication signature created using app credentials and session details.                                                                                                                                                              |
| `buffer_data`                                                                                                                                                                                                                             | <span class="prop-bool">bool</span>     | Optional. Default is `true`. When set to `false`, any audio data captured between the time the `rtms_started` webhook event is received and the time the signaling connection is established will be dropped.                                |
| > When `buffer_data` is set to `false`, only the initial buffer data is dropped. Audio data will continue to be buffered during connection interruptions, and any buffered data will be transmitted once a new connection is established. |
| `media_payload_key_mode` (V2)                                                                                                                                                                                                             | <span class="prop-int">int</span>       | Optional. The payload key mode: `1` for per-media derived keys (default), or `2` for a direct master key. Used with `payload_encryptions`.                                                                                                   |
| `payload_encryptions` (V2)                                                                                                                                                                                                                | <span class="prop-array">array</span>   | Optional. Encryption offers for payload encryption. Each offer has `key_wrap_algorithm`, `payload_encryption_algorithm`, `public_key` (PEM), and `key_id`. If omitted, payload encryption stays disabled. An empty array returns status `4`. |

## Signaling handshake response

<span className="pill_signaling">Sent from the signaling connection</span>

The signaling connection will respond with a signaling handshake response that includes the URLs of the media connections.

```json
{
    "msg_type": 2,
    "protocol_version": 2,
    "sequence": 0,
    "status_code": 0,
    "reason": "",
    "media_server": {
        "server_urls": {
            "audio": "wss://127.0.0.0:443",
            "video": "wss://127.0.0.0:443",
            "transcript": "wss://127.0.0.0:443",
            "all": "wss://127.0.0.0:443"
        }
    },
    "payload_encrypted": false
}
```

```json
{
    "msg_type": 2,
    "protocol_version": 1,
    "sequence": 0,
    "status_code": 0,
    "reason": "",
    "media_server": {
        "server_urls": {
            "audio": "wss://127.0.0.0:443",
            "video": "wss://127.0.0.0:443",
            "transcript": "wss://127.0.0.0:443",
            "all": "wss://127.0.0.0:443"
        }
    }
}
```

| Field                       | Type                                    | Description                                                                                                                                                                   |
| --------------------------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`                  | <span class="prop-int">int</span>       | The response from the signaling connection to the app after a handshake attempt. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type).     |
| `protocol_version`          | <span class="prop-int">int</span>       | The RTMS protocol version. Missing or below `2` selects V1. `2` or higher selects V2. See [Protocol versions](#protocol-versions).                                            |
| `sequence`                  | <span class="prop-int">int</span>       | The sequence number of the message.                                                                                                                                           |
| `status_code`               | <span class="prop-int">int</span>       | The status code of the message. Status `0` means success. For more information, see [RTMS_STATUS_CODE](/docs/rtms/data-types/#rtms_status_code).                              |
| `reason`                    | <span class="prop-string">string</span> | This is empty if successful. If failed, it will contain the reason for the failure.                                                                                           |
| `media_server`              | <span class="prop-object">object</span> | The media connection information.                                                                                                                                             |
| `server_urls`               | <span class="prop-array">object</span>  | Locations of available media connections. The response will depend on the app's available scopes. For example, if the app only supports audio, only `audio` will be included. |
| `payload_encrypted` (V2)    | <span class="prop-bool">bool</span>     | Whether payload encryption is enabled for the stream.                                                                                                                         |
| `srt_passphrase` (V2)       | <span class="prop-string">string</span> | Returned only when an SRT URL is configured. Base64-encoded text in JSON.                                                                                                     |
| `srt_pbkey_length` (V2)     | <span class="prop-int">int</span>       | Returned only when an SRT URL is configured.                                                                                                                                  |
| `payload_encryptions` (V2)  | <span class="prop-array">array</span>   | Returned when payload encryption is negotiated, with one entry per valid offer.                                                                                               |
| `wrapped_key` (V2)          | <span class="prop-string">string</span> | In each `payload_encryptions` entry, the payload key wrapped with the client's public key. Base64-encoded text in JSON.                                                       |
| `media_key_derivation` (V2) | <span class="prop-object">object</span> | Returned in key mode `1`. Contains the key derivation algorithm and parameters.                                                                                               |
| `media_derivations` (V2)    | <span class="prop-array">array</span>   | Within `media_key_derivation`, one entry per granted media type, with `media_type`, `salt`, and `info`. `salt` and `info` are Base64-encoded text in JSON.                    |

## Media handshake request

<span className="pill_media">Sent to the media connection</span>

To establish a connection, send a handshake request to the media connections of the RTMS server(s) that were included in the signaling handshake and include the associated media parameters. The media connection responds with confirmed parameters of the requested media types.

Apps can request all available media streams or specify media streams by content type. If all are requested, the signaling connection responds with all media connections available according to the app's requested scopes.

If the app has scopes for audio and transcript only, a request for all media will include audio and transcript data but not video, chat, or screen share data.

To request only one media type, specify that media type in the `media_type` field. For more information, see [MEDIA_DATA_TYPE](/docs/rtms/data-types/#media_data_type). Use `"media_type": 32` for all. In V2, `32` is rejected with status `48`, so request each media type separately.

Media parameters (`media_params`) are optional. If not specified, the default values will be used.

> For more information, see [Data type definitions](/docs/rtms/data-types) for options on codecs, resolutions, rates, etc.

The following tabs show a V2 request for each media type. In V2, request each media type on its own connection.

```json
{
    "msg_type": 3,
    "protocol_version": 2,
    "sequence": 0,
    "meeting_uuid": "4nYtdqLVTVqGJ+QB62ED7Q==",
    "rtms_stream_id": "03db704592624398931a588dd78200cb",
    "signature": "kDBZVzEWgox9tWVBc7DHsjW2OnVD/6H1zN2vdmU9VY8=",
    "media_type": 1,
    "media_params": {
        "audio": {
            "content_type": 2,
            "sample_rate": 1,
            "channel": 1,
            "codec": 1,
            "data_opt": 1,
            "send_rate": 20
        }
    }
}
```

```json
{
    "msg_type": 3,
    "protocol_version": 2,
    "sequence": 0,
    "meeting_uuid": "4nYtdqLVTVqGJ+QB62ED7Q==",
    "rtms_stream_id": "03db704592624398931a588dd78200cb",
    "signature": "kDBZVzEWgox9tWVBc7DHsjW2OnVD/6H1zN2vdmU9VY8=",
    "media_type": 2,
    "media_params": {
        "video": {
            "codec": 5,
            "resolution": 2,
            "fps": 5
        }
    }
}
```

```json
{
    "msg_type": 3,
    "protocol_version": 2,
    "sequence": 0,
    "meeting_uuid": "4nYtdqLVTVqGJ+QB62ED7Q==",
    "rtms_stream_id": "03db704592624398931a588dd78200cb",
    "signature": "kDBZVzEWgox9tWVBc7DHsjW2OnVD/6H1zN2vdmU9VY8=",
    "media_type": 4,
    "media_params": {
        "deskshare": {
            "codec": 5,
            "resolution": 3,
            "fps": 1
        }
    }
}
```

```json
{
    "msg_type": 3,
    "protocol_version": 2,
    "sequence": 0,
    "meeting_uuid": "4nYtdqLVTVqGJ+QB62ED7Q==",
    "rtms_stream_id": "03db704592624398931a588dd78200cb",
    "signature": "kDBZVzEWgox9tWVBc7DHsjW2OnVD/6H1zN2vdmU9VY8=",
    "media_type": 8,
    "media_params": {
        "transcript": {
            "content_type": 5,
            "src_language": 9,
            "enable_lid": true
        }
    }
}
```

```json
{
    "msg_type": 3,
    "protocol_version": 2,
    "sequence": 0,
    "meeting_uuid": "4nYtdqLVTVqGJ+QB62ED7Q==",
    "rtms_stream_id": "03db704592624398931a588dd78200cb",
    "signature": "kDBZVzEWgox9tWVBc7DHsjW2OnVD/6H1zN2vdmU9VY8=",
    "media_type": 16
}
```

The following tabs show a V1 request for each media type.

```json
{
    "msg_type": 3,
    "protocol_version": 1,
    "sequence": 0,
    "meeting_uuid": "4xxxxxxxxxx",
    "rtms_stream_id": "xxxxxxxxxx",
    "signature": "xxxxxxxxxx",
    "media_type": 32,
    "media_params": {
        "audio": {
            "content_type": 2,
            "sample_rate": 1,
            "channel": 1,
            "codec": 1,
            "data_opt": 1,
            "send_rate": 100
        },
        "video": {
            "codec": 5,
            "resolution": 2,
            "fps": 5
        },
        "deskshare": {
            "codec": 5,
            "resolution": 3,
            "fps": 1
        },
        "transcript": {
            "content_type": 5,
            "src_language": 9,
            "enable_lid": true
        }
    }
}
```

```json
{
    "msg_type": 3,
    "protocol_version": 1,
    "sequence": 0,
    "meeting_uuid": "4nYtdqLVTVqGJ+QB62ED7Q==",
    "rtms_stream_id": "03db704592624398931a588dd78200cb",
    "signature": "kDBZVzEWgox9tWVBc7DHsjW2OnVD/6H1zN2vdmU9VY8=",
    "media_type": 1,
    "media_params": {
        "audio": {
            "content_type": 2,
            "sample_rate": 1,
            "channel": 1,
            "codec": 1,
            "data_opt": 1,
            "send_rate": 20
        }
    }
}
```

```json
{
    "msg_type": 3,
    "protocol_version": 1,
    "sequence": 0,
    "meeting_uuid": "4nYtdqLVTVqGJ+QB62ED7Q==",
    "rtms_stream_id": "03db704592624398931a588dd78200cb",
    "signature": "kDBZVzEWgox9tWVBc7DHsjW2OnVD/6H1zN2vdmU9VY8=",
    "media_type": 2,
    "media_params": {
        "video": {
            "codec": 5,
            "resolution": 2,
            "fps": 5
        }
    }
}
```

```json
{
    "msg_type": 3,
    "protocol_version": 1,
    "sequence": 0,
    "meeting_uuid": "4nYtdqLVTVqGJ+QB62ED7Q==",
    "rtms_stream_id": "03db704592624398931a588dd78200cb",
    "signature": "kDBZVzEWgox9tWVBc7DHsjW2OnVD/6H1zN2vdmU9VY8=",
    "media_type": 4,
    "media_params": {
        "deskshare": {
            "codec": 5,
            "resolution": 3,
            "fps": 1
        }
    }
}
```

```json
{
    "msg_type": 3,
    "protocol_version": 1,
    "sequence": 0,
    "meeting_uuid": "4nYtdqLVTVqGJ+QB62ED7Q==",
    "rtms_stream_id": "03db704592624398931a588dd78200cb",
    "signature": "kDBZVzEWgox9tWVBc7DHsjW2OnVD/6H1zN2vdmU9VY8=",
    "media_type": 8,
    "media_params": {
        "transcript": {
            "content_type": 5,
            "src_language": 9,
            "enable_lid": true
        }
    }
}
```

```json
{
    "msg_type": 3,
    "protocol_version": 1,
    "sequence": 0,
    "meeting_uuid": "4nYtdqLVTVqGJ+QB62ED7Q==",
    "rtms_stream_id": "03db704592624398931a588dd78200cb",
    "signature": "kDBZVzEWgox9tWVBc7DHsjW2OnVD/6H1zN2vdmU9VY8=",
    "media_type": 16
}
```

| Field                                                                                              | Type                                    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| -------------------------------------------------------------------------------------------------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`                                                                                         | <span class="prop-int">int</span>       | The app sends this message to the media connection to request a connection with the specified media parameters. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type).                                                                                                                                                                                                                                                                                                                                                               |
| `protocol_version`                                                                                 | <span class="prop-int">int</span>       | The RTMS protocol version. Missing or below `2` selects V1. `2` or higher selects V2. See [Protocol versions](#protocol-versions).                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `sequence`                                                                                         | <span class="prop-int">int</span>       | The sequence number of the message.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `meeting_uuid`                                                                                     | <span class="prop-string">string</span> | The unique identifier for the session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `rtms_stream_id`                                                                                   | <span class="prop-string">string</span> | The unique identifier of the RTMS stream. Multiple streams are possible for a session if streaming access stops or restarts.                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `signature`                                                                                        | <span class="prop-string">string</span> | The authentication signature created using app credentials and session details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `media_type`                                                                                       | <span class="prop-int">int</span>       | The media type of the stream, either audio (1), video (2), screen share (4), transcript (8), chat (16), or all (32). For more information, see [MEDIA_DATA_TYPE](/docs/rtms/data-types/#media_data_type).                                                                                                                                                                                                                                                                                                                                                              |
| `media_params` (Optional)                                                                          | <span class="prop-int">object</span>    | The media parameters of the stream that define the media formats. Parameters are set to default if not specified and returned in the response.                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `content_type`                                                                                     | <span class="prop-int">int</span>       | The content type of the media stream, either RTP (1), raw audio (2), raw video (3), file stream (4), or text (5). For more information, see [MEDIA_CONTENT_TYPE](/docs/rtms/data-types/#media_content_type).                                                                                                                                                                                                                                                                                                                                                           |
| `sample_rate` (audio)                                                                              | <span class="prop-int">int</span>       | The sample rate of the audio stream. For more information, see [AUDIO_SAMPLE_RATE](/docs/rtms/data-types/#audio_sample_rate).                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `channel` (audio)                                                                                  | <span class="prop-int">int</span>       | The channel of the audio stream, either mono (1) or stereo (2). For more information, see [AUDIO_CHANNEL](/docs/rtms/data-types/#audio_channel).                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `codec` (audio)                                                                                    | <span class="prop-int">int</span>       | The codec of the audio data. Can be L16 (1), G711 (2), G722 (3), or Opus (4). For more information, see [MEDIA_PAYLOAD_TYPE](/docs/rtms/data-types/#media_payload_type).                                                                                                                                                                                                                                                                                                                                                                                               |
| `data_opt` (audio)                                                                                 | <span class="prop-int">int</span>       | Defines whether media is separated or merged. For example, mixed audio or separated audio streams. For more information, see [MEDIA_DATA_OPTION](/docs/rtms/data-types/#media_data_option).                                                                                                                                                                                                                                                                                                                                                                            |
| `send_rate` (audio)                                                                                | <span class="prop-int">int</span>       | The send rate of the audio stream in milliseconds (ms). Must be a multiple of 20, up to 1000 ms.                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `codec` (video)                                                                                    | <span class="prop-int">int</span>       | The codec of the video data that is set during the handshake and doesn't change during the session. **Protocol V2:** PNG isn't available. Use JPG at `fps` 5 or lower, and H.264 above 5 fps.**Protocol V1:** Can be JPG or PNG when `fps` {'<='} 5, and H.264 when `fps` > 5. The default is JPG with an `fps` of 5.If the handshake request sets the `fps` > 5 but doesn't specify a `codec`, the server will set the `codec` to JPG (default) and the `fps` to 5. For more information, see [MEDIA_PAYLOAD_TYPE](/docs/rtms/data-types/#media_payload_type).        |
| `codec` (screen share)                                                                             | <span class="prop-int">int</span>       | The codec of the screen share data that is set during the handshake and doesn't change during the session. **Protocol V2:** PNG isn't available. Use JPG at `fps` 1 or lower, and H.264 above 1 fps.**Protocol V1:** Can be JPG or PNG when `fps` {'<='} 1, and H.264 when `fps` > 1. The default is JPG with an `fps` of 1.If the handshake request sets the `fps` > 1 but doesn't specify a `codec`, the server will set the `codec` to JPG (default) and the `fps` to 1. For more information, see [MEDIA_PAYLOAD_TYPE](/docs/rtms/data-types/#media_payload_type). |
| `resolution` (video)                                                                               | <span class="prop-int">int</span>       | The resolution of the video stream. Can be SD (1), HD (2), FHD (3), or QHD (4). The default is HD. SD is 360p (640×360). For more information, see [MEDIA_RESOLUTION](/docs/rtms/data-types/#media_resolution).                                                                                                                                                                                                                                                                                                                                                        |
| `resolution` (screen share)                                                                        | <span class="prop-int">int</span>       | The resolution of the screen share stream. Can be SD (1), HD (2), FHD (3), or QHD (4). The default is FHD. For more information, see [MEDIA_RESOLUTION](/docs/rtms/data-types/#media_resolution).                                                                                                                                                                                                                                                                                                                                                                      |
| `fps` (video & screen share)                                                                       | <span class="prop-int">int</span>       | The frames per second of the video stream. Maximum of 30.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `src_language`                                                                                     | <span class="prop-int">int</span>       | Optional. The language of the transcript. If not specified, English will be the default language for the first 30 seconds of transcription. If specified, RTMS will transcribe the first 30 seconds of audio based on this language setting. For more information, see [RTMS_TRANSCRIPT_LANGUAGE](/docs/rtms/data-types/#rtms_transcript_language).                                                                                                                                                                                                                    |
| > After 30 seconds, the audio language will be automatically detected and override this parameter. |
| `enable_lid`                                                                                       | <span class="prop-bool">bool</span>     | Optional. Default is true and Language Identification is enabled. When set to false, Language Identification is disabled and transcription will rely solely on the `src_language` parameter.                                                                                                                                                                                                                                                                                                                                                                           |

If a V2 data handshake requests `media_type: 32`, the response has status `48`. The `protocol_version` in this response is always `1`, and it doesn't change the stream's V2 protocol.

```json
{
    "msg_type": 4,
    "protocol_version": 1,
    "status_code": 48,
    "reason": "Media data type ALL is not supported by this protocol version"
}
```

## Media handshake response

<span className="pill_media">Sent from the media connection</span>

The media connection will respond with with a media handshake response that includes information about the media connections.

The following tabs show a V2 response for each media type.

```json
{
    "msg_type": 4,
    "protocol_version": 2,
    "status_code": 0,
    "reason": "OK",
    "sequence": 0,
    "connection_id": "conn-audio-1",
    "payload_encrypted": false,
    "media_params": {
        "audio": {
            "content_type": 2,
            "sample_rate": 1,
            "channel": 1,
            "codec": 1,
            "data_opt": 1,
            "send_rate": 20
        }
    }
}
```

```json
{
    "msg_type": 4,
    "protocol_version": 2,
    "status_code": 0,
    "reason": "OK",
    "sequence": 0,
    "connection_id": "conn-video-1",
    "payload_encrypted": false,
    "media_params": {
        "video": {
            "content_type": 3,
            "codec": 5,
            "resolution": 2,
            "data_opt": 3,
            "fps": 5
        }
    }
}
```

```json
{
    "msg_type": 4,
    "protocol_version": 2,
    "status_code": 0,
    "reason": "OK",
    "sequence": 0,
    "connection_id": "conn-deskshare-1",
    "payload_encrypted": false,
    "media_params": {
        "deskshare": {
            "content_type": 3,
            "codec": 5,
            "resolution": 3,
            "fps": 1
        }
    }
}
```

```json
{
    "msg_type": 4,
    "protocol_version": 2,
    "status_code": 0,
    "reason": "OK",
    "sequence": 0,
    "connection_id": "conn-transcript-1",
    "payload_encrypted": false,
    "media_params": {
        "transcript": {
            "content_type": 5,
            "src_language": 9,
            "enable_lid": true
        }
    }
}
```

```json
{
    "msg_type": 4,
    "protocol_version": 2,
    "status_code": 0,
    "reason": "OK",
    "sequence": 0,
    "connection_id": "conn-chat-1",
    "payload_encrypted": false,
    "media_params": {
        "chat": {
            "content_type": 5
        }
    }
}
```

The following tabs show a V1 response for each media type.

```json
{
    "msg_type": 4,
    "protocol_version": 1,
    "status_code": 0,
    "reason": "",
    "sequence": 0,
    "payload_encrypted": true,
    "media_params": {
        "audio": {
            "content_type": 2,
            "sample_rate": 1,
            "channel": 1,
            "codec": 1,
            "data_opt": 1,
            "send_rate": 100
        },
        "video": {
            "content_type": 3,
            "codec": 5,
            "resolution": 2,
            "data_opt": 3,
            "fps": 5
        },
        "deskshare": {
            "content_type": 3,
            "codec": 5,
            "resolution": 3,
            "fps": 1
        },
        "transcript": {
            "content_type": 5,
            "src_language": 9,
            "enable_lid": true
        },
        "chat": {
            "content_type": 5
        }
    }
}
```

```json
{
    "msg_type": 4,
    "protocol_version": 1,
    "status_code": 0,
    "reason": "",
    "sequence": 0,
    "payload_encrypted": true,
    "media_params": {
        "audio": {
            "content_type": 2,
            "sample_rate": 1,
            "channel": 1,
            "codec": 1,
            "data_opt": 1,
            "send_rate": 100
        }
    }
}
```

```json
{
    "msg_type": 4,
    "protocol_version": 1,
    "status_code": 0,
    "reason": "",
    "sequence": 0,
    "payload_encrypted": true,
    "media_params": {
        "video": {
            "content_type": 3,
            "codec": 5,
            "resolution": 2,
            "data_opt": 3,
            "fps": 5
        }
    }
}
```

```json
{
    "msg_type": 4,
    "protocol_version": 1,
    "status_code": 0,
    "reason": "",
    "sequence": 0,
    "payload_encrypted": true,
    "media_params": {
        "deskshare": {
            "content_type": 3,
            "codec": 5,
            "resolution": 3,
            "fps": 1
        }
    }
}
```

```json
{
    "msg_type": 4,
    "protocol_version": 1,
    "status_code": 0,
    "reason": "",
    "sequence": 0,
    "payload_encrypted": true,
    "media_params": {
        "transcript": {
            "content_type": 5,
            "src_language": 9,
            "enable_lid": true
        }
    }
}
```

```json
{
    "msg_type": 4,
    "protocol_version": 1,
    "status_code": 0,
    "reason": "",
    "sequence": 0,
    "payload_encrypted": true,
    "media_params": {
        "chat": {
            "content_type": 5
        }
    }
}
```

| Field                                                                                              | Type                                    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| -------------------------------------------------------------------------------------------------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`                                                                                         | <span class="prop-int">int</span>       | The response from the media connection to the app after a handshake attempt. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type).                                                                                                                                                                                                                                                                                                                                                                                                  |
| `protocol_version`                                                                                 | <span class="prop-int">int</span>       | The RTMS protocol version. Missing or below `2` selects V1. `2` or higher selects V2. See [Protocol versions](#protocol-versions).                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `status_code`                                                                                      | <span class="prop-int">int</span>       | The status code of the message. Status `0` means success. For more information, see [RTMS_STATUS_CODE](/docs/rtms/data-types/#rtms_status_code).                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `reason`                                                                                           | <span class="prop-string">string</span> | This is empty if successful. If failed, it will contain the reason for the failure.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `sequence`                                                                                         | <span class="prop-int">int</span>       | The sequence number of the message.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `payload_encrypted` (Optional)                                                                     | <span class="prop-bool">bool</span>     | Indicates whether the payload is encrypted. For V2 streams, it's `true` when payload encryption was negotiated in the signaling handshake and the data parameters validated.                                                                                                                                                                                                                                                                                                                                                                                           |
| `content_type`                                                                                     | <span class="prop-int">int</span>       | The content type of the media. For more information, see [MEDIA_CONTENT_TYPE](/docs/rtms/data-types/#media_content_type).                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `sample_rate`                                                                                      | <span class="prop-int">int</span>       | The sample rate of the audio stream. For more information, see [AUDIO_SAMPLE_RATE](/docs/rtms/data-types/#audio_sample_rate).                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `channel`                                                                                          | <span class="prop-int">int</span>       | The channel of the audio stream, either mono (1) or stereo (2). For more information, see [AUDIO_CHANNEL](/docs/rtms/data-types/#audio_channel).                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `codec`                                                                                            | <span class="prop-int">int</span>       | The codec of the audio data. Can be L16 (1), G711 (2), G722 (3), or Opus (4). For more information, see [MEDIA_PAYLOAD_TYPE](/docs/rtms/data-types/#media_payload_type).                                                                                                                                                                                                                                                                                                                                                                                               |
| `data_opt`                                                                                         | <span class="prop-int">int</span>       | Defines whether media is separated or merged. For example, mixed audio or separated audio streams. For more information, see [MEDIA_DATA_OPTION](/docs/rtms/data-types/#media_data_option).                                                                                                                                                                                                                                                                                                                                                                            |
| `send_rate`                                                                                        | <span class="prop-int">int</span>       | The send rate of the audio stream in milliseconds (ms). Must be a multiple of 20. Can be up to 1000 ms.                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `codec` (video)                                                                                    | <span class="prop-int">int</span>       | The codec of the video data that is set during the handshake and doesn't change during the session. **Protocol V2:** PNG isn't available. Use JPG at `fps` 5 or lower, and H.264 above 5 fps.**Protocol V1:** Can be JPG or PNG when `fps` {'<='} 5, and H.264 when `fps` > 5. The default is JPG with an `fps` of 5.If the handshake request sets the `fps` > 5 but doesn't specify a `codec`, the server will set the `codec` to JPG (default) and the `fps` to 5. For more information, see [MEDIA_PAYLOAD_TYPE](/docs/rtms/data-types/#media_payload_type).        |
| `codec` (screen share)                                                                             | <span class="prop-int">int</span>       | The codec of the screen share data that is set during the handshake and doesn't change during the session. **Protocol V2:** PNG isn't available. Use JPG at `fps` 1 or lower, and H.264 above 1 fps.**Protocol V1:** Can be JPG or PNG when `fps` {'<='} 1, and H.264 when `fps` > 1. The default is JPG with an `fps` of 1.If the handshake request sets the `fps` > 1 but doesn't specify a `codec`, the server will set the `codec` to JPG (default) and the `fps` to 1. For more information, see [MEDIA_PAYLOAD_TYPE](/docs/rtms/data-types/#media_payload_type). |
| `resolution` (video)                                                                               | <span class="prop-int">int</span>       | The resolution of the video stream. Can be SD (1), HD (2), FHD (3), or QHD (4). The default is HD. SD is 360p (640×360). For more information, see [MEDIA_RESOLUTION](/docs/rtms/data-types/#media_resolution).                                                                                                                                                                                                                                                                                                                                                        |
| `resolution` (screen share)                                                                        | <span class="prop-int">int</span>       | The resolution of the screen share stream. Can be SD (1), HD (2), FHD (3), or QHD (4). The default is FHD. For more information, see [MEDIA_RESOLUTION](/docs/rtms/data-types/#media_resolution).                                                                                                                                                                                                                                                                                                                                                                      |
| `fps` (video & screen share)                                                                       | <span class="prop-int">int</span>       | The frames per second of the video stream. Maximum of 30.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `src_language`                                                                                     | <span class="prop-int">int</span>       | Optional. The language of the transcript. If not specified, English will be the default language for the first 30 seconds of transcription. If specified, RTMS will transcribe the first 30 seconds of audio based on this language setting. For more information, see [RTMS_TRANSCRIPT_LANGUAGE](/docs/rtms/data-types/#rtms_transcript_language).                                                                                                                                                                                                                    |
| > After 30 seconds, the audio language will be automatically detected and override this parameter. |
| `enable_lid`                                                                                       | <span class="prop-bool">bool</span>     | Optional. Default is true and Language Identification is enabled. When set to false, Language Identification is disabled and transcription will rely solely on the `src_language` parameter.                                                                                                                                                                                                                                                                                                                                                                           |
| `connection_id` (V2)                                                                               | <span class="prop-string">string</span> | The identifier of the data connection.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

A V2 data handshake doesn't create a second payload key or change the key mode.

## Client ready ACK message

<span className="pill_signaling">Sent to the signaling connection</span>

After the app receives the data handshake response from the media connection, it needs to send a client ready ack to the signaling connection to indicate that the full handshake has completed and that it is ready to receive media data.

This message should be sent after the signaling and media connections have been established.

```json
{
    "msg_type": 7,
    "rtms_stream_id": "xxxxxxxxxx"
}
```

| Field            | Type                                    | Description                                                                                                                                                                                               |
| ---------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`       | <span class="prop-int">int</span>       | The app sends this message to the signaling connection to acknowledge that the server is ready to receive media. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `rtms_stream_id` | <span class="prop-string">string</span> | The unique identifier for the RTMS stream.                                                                                                                                                                |

## Keep-alive request

<span className="pill_media">Sent from the media connection</span>

To maintain stable connections and prevent timeouts, RTMS servers send a keep-alive request to both the signaling and media connections every 10 seconds.

When three keep-alive requests are unanswered, the RTMS server takes different actions for the different connection types.

-   **Signaling connection** - The RTMS server will interrupt both the signaling and media connections, wait for one minute to allow for reconnection, and, if the connection is not restored, it will end the RTMS stream.

-   **Media connections** - The RTMS server will interrupt the media connection, wait for 65 seconds to allow for reconnection, and, if the connection is not restored, it will end the RTMS stream.

If an app doesn't receive a keep-alive request for 65 seconds, we recommend that the app reestablish the connection by resending the [signaling handshake request](/docs/rtms/event-reference/#signaling-handshake-request). For more information, see [Working with streams](/docs/rtms/event-reference/).

The RTMS server sends the following request to confirm the app wants to maintain a connection.

```json
{
    "msg_type": 12,
    "timestamp": 1727384349123
}
```

| Field       | Type                                          | Description                                                                                                                                                                         |
| ----------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`  | <span class="prop-int">int</span>             | The media connection sends this message to confirm the app wants to maintain a connection. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `timestamp` | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of the request.                                                                                                                                                  |

## Keep-alive response

<span className="pill_media">Sent to the media connection</span>

To maintain the connection, an app should respond to the request with the following response. The timestamp in the response must match the request.

```json
{
    "msg_type": 13,
    "timestamp": 1727384349123
}
```

| Field       | Type                                          | Description                                                                                                                                                           |
| ----------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`  | <span class="prop-int">int</span>             | The app sends this message to the media connection to maintain a connection. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `timestamp` | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of the keep-alive request.                                                                                                                         |

## Subscribe to events

<span className="pill_signaling">Sent to the signaling connection</span>

Send this message to the signaling connection to get data about behavior during sessions.

> **Note**
>
> Some events are sent automatically and don't need to be subscribed to. To ensure your app works as expected, don't subscribe to these events.
>
> -   FIRST_PACKET_TIMESTAMP (`event_code` 1, legacy `event_type` 1)
> -   MEDIA_CONNECTION_INTERRUPTED (`event_code` 2, legacy `event_type` 7)

JSON subscriptions support [session events](/docs/rtms/event-reference/session-events/) only. [Zoom Contact Center voice events](/docs/rtms/event-reference/contact-center-events/) and Zoom Phone events don't use this JSON subscription API.

The request format depends on the protocol version. V2 requests use `event_code`, and V1 requests use the legacy `event_type`. An entry must not contain both fields. Mixing them returns a `REQUEST_ERROR_RESP` message (`msg_type` `30`) with status `6`.

The server sends no success response for subscribe or unsubscribe requests. The requested state takes effect immediately. The server sends a [request error response](/docs/rtms/event-reference/universal-events/#request-error-response) only for invalid requests.

```json
{
    "msg_type": 5,
    "events": [
        {
            "event_code": 1000,
            "subscribe": true
        }
    ]
}
```

```json
{
    "msg_type": 5,
    "events": [
        {
            "event_type": 2,
            "subscribe": true
        }
    ]
}
```

| Field             | Type                                | Description                                                                                                                                                                                                                     |
| ----------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`        | <span class="prop-int">int</span>   | The app sends this message to the signaling connection to subscribe or unsubscribe to in-session events from the signaling connection. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `event_code` (V2) | <span class="prop-int">int</span>   | The event to subscribe to. Session events `1000` to `1011` are supported. For more information, see [RTMS_EVENT_CODE](/docs/rtms/data-types/#rtms_event_code).                                                                  |
| `event_type` (V1) | <span class="prop-int">int</span>   | The legacy event to subscribe to. For more information, see [RTMS_EVENT_TYPE](/docs/rtms/data-types/#rtms_event_type).                                                                                                          |
| `subscribe`       | <span class="prop-bool">bool</span> | A boolean. `True` - subscribe to events `False` - unsubscribe from events                                                                                                                                                       |

## Audio data

<span className="pill_media">Sent from the media connection</span>

Audio data from the media connection of a participant in a session. It can be either merged audio or individual audio.

```json
{
    "msg_type": 14,
    "content": {
        "user_id": 16778240,
        "user_name": "John Smith",
        "source": 1,
        "data": "Hw1kDacNAA4sDkMOAQ5eDekMgAzXCw0L4Al4CDwHBAayBEwDmwHD/wn+rfyQ+3z6Z/k4+Ef3jvb09aj1YPUF9QL1OfVt9eH1f/YE96P3jPib+dX6Pvyr/ef+IABcAZ4CmQN3BFAF6QVxBs0G9wbjBqYGXwYFBm8FxwT/Aw4DHAIkARYA7v6o/T382/qq+YD4fPd99mz1p/Qq9KTzcfNv807zcPPQ8z70yfQ89az1SPbO9m/3Lfjf+I75M/rz+pT7KPzs/In9Fv7G/lP/q/8GAG4AtgBHAcABDQKtAkwDIgRQBYQGrgfyCEgKigvDDP4NFw/8D78QhBErEqoS/BL5EsYSfRLnEXARwhCMD1kO8ww8C5gJ5gfrBe8D3AGp/7P9IPyY+hL5t/dl9mv10fQ89NjzvvO78/HzbfTb9F71I/bw9vL3Kvlh+pX71/wr/m//owDCAbQCkwNoBPYEYQWxBZ0FZQUdBYkEBgRkA64CAgIdAT0AZf+T/tD93vz9+xf7B/o8+WX4pvcE90L2n/VM9d70pPSe9IL0nfTa9BX1cfXK9QP2S/a69hH3cPfx91P4w/hO+cr5XPr2+l/71/t9/AP9f/0R/p/+Pv/5/7IAWAH+AeMCAwQ7BaAG+wcmCZEKKQy8DT4PWhBXEVYSVBOgFM0VMxZSFhYW4BXTFUMVNBSzEtIQJg99Da0LogkXB40ESgJCAHj+ivyA+qn4KfcH9hr1JvRf89byq/Lt8kjzhvPy85P0n/X/9kn4lvni+kj84P1S/4wAuwHUAvcD9wS/BUwGaAZcBmcGTQb5BUkFQgQzAzkCVQEgALX+U/3N+4L6XfkU+Nj2o/WB9MTzOfO38g==",
        "length": 1024,
        "timestamp": 1738392033699
    }
}
```

```json
{
    "msg_type": 14,
    "content": {
        "user_name": "John Smith",
        "data": "Hw1kDacNAA4sDkMOAQ5eDekMgAzXCw0L4Al4CDwHBAayBEwDmwHD/wn+rfyQ+3z6Z/k4+Ef3jvb09aj1YPUF9QL1OfVt9eH1f/YE96P3jPib+dX6Pvyr/ef+IABcAZ4CmQN3BFAF6QVxBs0G9wbjBqYGXwYFBm8FxwT/Aw4DHAIkARYA7v6o/T382/qq+YD4fPd99mz1p/Qq9KTzcfNv807zcPPQ8z70yfQ89az1SPbO9m/3Lfjf+I75M/rz+pT7KPzs/In9Fv7G/lP/q/8GAG4AtgBHAcABDQKtAkwDIgRQBYQGrgfyCEgKigvDDP4NFw/8D78QhBErEqoS/BL5EsYSfRLnEXARwhCMD1kO8ww8C5gJ5gfrBe8D3AGp/7P9IPyY+hL5t/dl9mv10fQ89NjzvvO78/HzbfTb9F71I/bw9vL3Kvlh+pX71/wr/m//owDCAbQCkwNoBPYEYQWxBZ0FZQUdBYkEBgRkA64CAgIdAT0AZf+T/tD93vz9+xf7B/o8+WX4pvcE90L2n/VM9d70pPSe9IL0nfTa9BX1cfXK9QP2S/a69hH3cPfx91P4w/hO+cr5XPr2+l/71/t9/AP9f/0R/p/+Pv/5/7IAWAH+AeMCAwQ7BaAG+wcmCZEKKQy8DT4PWhBXEVYSVBOgFM0VMxZSFhYW4BXTFUMVNBSzEtIQJg99Da0LogkXB40ESgJCAHj+ivyA+qn4KfcH9hr1JvRf89byq/Lt8kjzhvPy85P0n/X/9kn4lvni+kj84P1S/4wAuwHUAvcD9wS/BUwGaAZcBmcGTQb5BUkFQgQzAzkCVQEgALX+U/3N+4L6XfkU+Nj2o/WB9MTzOfO38g=="
    }
}
```

```json
{
    "msg_type": 14,
    "content": {
        "channel_id": "c8b2d3ce-b0d6-4cd1-9195-fe17a4bd5b8e",
        "data": "Hw1kDacNAA4sDkMOAQ5eDekMgAzXCw0L4Al4CDwHBAayBEwDmwHD/wn+rfyQ+3z6Z/k4+Ef3jvb09aj1YPUF9QL1OfVt9eH1f/YE96P3jPib+dX6Pvyr/ef+IABcAZ4CmQN3BFAF6QVxBs0G9wbjBqYGXwYFBm8FxwT/Aw4DHAIkARYA7v6o/T382/qq+YD4fPd99mz1p/Qq9KTzcfNv807zcPPQ8z70yfQ89az1SPbO9m/3Lfjf+I75M/rz+pT7KPzs/In9Fv7G/lP/q/8GAG4AtgBHAcABDQKtAkwDIgRQBYQGrgfyCEgKigvDDP4NFw/8D78QhBErEqoS/BL5EsYSfRLnEXARwhCMD1kO8ww8C5gJ5gfrBe8D3AGp/7P9IPyY+hL5t/dl9mv10fQ89NjzvvO78/HzbfTb9F71I/bw9vL3Kvlh+pX71/wr/m//owDCAbQCkwNoBPYEYQWxBZ0FZQUdBYkEBgRkA64CAgIdAT0AZf+T/tD93vz9+xf7B/o8+WX4pvcE90L2n/VM9d70pPSe9IL0nfTa9BX1cfXK9QP2S/a69hH3cPfx91P4w/hO+cr5XPr2+l/71/t9/AP9f/0R/p/+Pv/5/7IAWAH+AeMCAwQ7BaAG+wcmCZEKKQy8DT4PWhBXEVYSVBOgFM0VMxZSFhYW4BXTFUMVNBSzEtIQJg99Da0LogkXB40ESgJCAHj+ivyA+qn4KfcH9hr1JvRf89byq/Lt8kjzhvPy85P0n/X/9kn4lvni+kj84P1S/4wAuwHUAvcD9wS/BUwGaAZcBmcGTQb5BUkFQgQzAzkCVQEgALX+U/3N+4L6XfkU+Nj2o/WB9MTzOfO38g==",
        "length": 1024,
        "timestamp": 1738392033699
    }
}
```

| Field        | Type                                          | Description                                                                                                                                                                                                                                     |
| ------------ | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`   | <span class="prop-int">int</span>             | Audio data sent from the media connection. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type).                                                                                                             |
| `user_id`    | <span class="prop-int">int</span>             | The unique identifier of the participant whose audio is included in the data.                                                                                                                                                                   |
| `user_name`  | <span class="prop-string">string</span>       | The username of the participant whose audio is included in the data. If the `user_id` in the RTP header is `0`, no `user_name` will be sent.                                                                                                    |
| `source`     | <span class="prop-int">int</span>             | The source of the audio. `1` for microphone audio, or `2` for shared-content audio. This lets you tell screen-share audio apart from microphone input. For more information, see [AUDIO_DATA_SOURCE](/docs/rtms/data-types/#audio_data_source). |
| `channel_id` | <span class="prop-string">string</span>       | For Zoom Contact Center engagements, the unique identifier of the SIP trunk channel that carries this audio. Each party in an engagement is on a separate channel, so `channel_id` identifies which side of the call this audio belongs to.     |
| `data`       | <span class="prop-string">string</span>       | Audio data, base64-encoded binary.                                                                                                                                                                                                              |
| `length`     | <span class="prop-int">int</span>             | The length of the original binary data before base64 encoding.                                                                                                                                                                                  |
| `timestamp`  | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of the data.                                                                                                                                                                                                                 |

## Video data

<span className="pill_media">Sent from the media connection</span>

Video data from the media connection of the **Active speaker** participant in a session.

```json
{
    "msg_type": 15,
    "content": {
        "user_id": 16778240,
        "user_name": "John Smith",
        "data": "Hw1kDacNAA4sDkMOAQ5eDekMgAzXCw0L4Al4CDwHBAayBEwDmwHD/wn+rfyQ+3z6Z/k4+Ef3jvb09aj1YPUF9QL1OfVt9eH1f/YE96P3jPib+dX6Pvyr/ef+IABcAZ4CmQN3BFAF6QVxBs0G9wbjBqYGXwYFBm8FxwT/Aw4DHAIkARYA7v6o/T382/qq+YD4fPd99mz1p/Qq9KTzcfNv807zcPPQ8z70yfQ89az1SPbO9m/3Lfjf+I75M/rz+pT7KPzs/In9Fv7G/lP/q/8GAG4AtgBHAcABDQKtAkwDIgRQBYQGrgfyCEgKigvDDP4NFw/8D78QhBErEqoS/BL5EsYSfRLnEXARwhCMD1kO8ww8C5gJ5gfrBe8D3AGp/7P9IPyY+hL5t/dl9mv10fQ89NjzvvO78/HzbfTb9F71I/bw9vL3Kvlh+pX71/wr/m//owDCAbQCkwNoBPYEYQWxBZ0FZQUdBYkEBgRkA64CAgIdAT0AZf+T/tD93vz9+xf7B/o8+WX4pvcE90L2n/VM9d70pPSe9IL0nfTa9BX1cfXK9QP2S/a69hH3cPfx91P4w/hO+cr5XPr2+l/71/t9/AP9f/0R/p/+Pv/5/7IAWAH+AeMCAwQ7BaAG+wcmCZEKKQy8DT4PWhBXEVYSVBOgFM0VMxZSFhYW4BXTFUMVNBSzEtIQJg99Da0LogkXB40ESgJCAHj+ivyA+qn4KfcH9hr1JvRf89byq/Lt8kjzhvPy85P0n/X/9kn4lvni+kj84P1S/4wAuwHUAvcD9wS/BUwGaAZcBmcGTQb5BUkFQgQzAzkCVQEgALX+U/3N+4L6XfkU+Nj2o/WB9MTzOfO38g==",
        "length": 1024,
        "timestamp": 1738392033699
    }
}
```

| Field       | Type                                          | Description                                                                                                                         |
| ----------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`  | <span class="prop-int">int</span>             | Video data sent from the media connection. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `user_id`   | <span class="prop-int">int</span>             | The unique identifier of the participant whose video was included in the data.                                                      |
| `user_name` | <span class="prop-string">string</span>       | The username of the participant whose video was included in the data.                                                               |
| `data`      | <span class="prop-string">string</span>       | Video data, base64-encoded binary.                                                                                                  |
| `length`    | <span class="prop-int">int</span>             | The length of the original binary data before base64 encoding.                                                                      |
| `timestamp` | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of the data.                                                                                                     |

## Screen share data

<span className="pill_media">Sent from the media connection</span>

Content shared by a participant in a session sent from the media connection.

```json
{
    "msg_type": 16,
    "content": {
        "user_id": 16778240,
        "user_name": "John Smith",
        "data": "Hw1kDacNAA4sDkMOAQ5eDekMgAzXCw0L4Al4CDwHBAayBEwDmwHD/wn+rfyQ+3z6Z/k4+Ef3jvb09aj1YPUF9QL1OfVt9eH1f/YE96P3jPib+dX6Pvyr/ef+IABcAZ4CmQN3BFAF6QVxBs0G9wbjBqYGXwYFBm8FxwT/Aw4DHAIkARYA7v6o/T382/qq+YD4fPd99mz1p/Qq9KTzcfNv807zcPPQ8z70yfQ89az1SPbO9m/3Lfjf+I75M/rz+pT7KPzs/In9Fv7G/lP/q/8GAG4AtgBHAcABDQKtAkwDIgRQBYQGrgfyCEgKigvDDP4NFw/8D78QhBErEqoS/BL5EsYSfRLnEXARwhCMD1kO8ww8C5gJ5gfrBe8D3AGp/7P9IPyY+hL5t/dl9mv10fQ89NjzvvO78/HzbfTb9F71I/bw9vL3Kvlh+pX71/wr/m//owDCAbQCkwNoBPYEYQWxBZ0FZQUdBYkEBgRkA64CAgIdAT0AZf+T/tD93vz9+xf7B/o8+WX4pvcE90L2n/VM9d70pPSe9IL0nfTa9BX1cfXK9QP2S/a69hH3cPfx91P4w/hO+cr5XPr2+l/71/t9/AP9f/0R/p/+Pv/5/7IAWAH+AeMCAwQ7BaAG+wcmCZEKKQy8DT4PWhBXEVYSVBOgFM0VMxZSFhYW4BXTFUMVNBSzEtIQJg99Da0LogkXB40ESgJCAHj+ivyA+qn4KfcH9hr1JvRf89byq/Lt8kjzhvPy85P0n/X/9kn4lvni+kj84P1S/4wAuwHUAvcD9wS/BUwGaAZcBmcGTQb5BUkFQgQzAzkCVQEgALX+U/3N+4L6XfkU+Nj2o/WB9MTzOfO38g==",
        "length": 1024,
        "timestamp": 1738392033699
    }
}
```

| Field       | Type                                          | Description                                                                                                                                |
| ----------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `msg_type`  | <span class="prop-int">int</span>             | Screen share data sent from the media connection. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `user_id`   | <span class="prop-int">int</span>             | The unique identifier of the participant who shared their screen.                                                                          |
| `user_name` | <span class="prop-string">string</span>       | The username of the participant who shared their screen.                                                                                   |
| `data`      | <span class="prop-string">string</span>       | Screen share video data, base64-encoded binary.                                                                                            |
| `length`    | <span class="prop-int">int</span>             | The length of the original binary data before base64 encoding.                                                                             |
| `timestamp` | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of the data.                                                                                                            |

## Transcript data

<span className="pill_media">Sent from the media connection</span>

Transcript of the spoken audio in a session sent from the media connection. Messages will be sent separately for each participant who has spoken.

```json
{
    "msg_type": 17,
    "content": {
        "user_id": 19778240,
        "user_name": "John Smith",
        "start_time": 1727384100000,
        "end_time": 1727384310000,
        "timestamp": 1727384349000,
        "language": 9,
        "data": "Hi, hello world!"
    }
}
```

```json
{
    "msg_type": 17,
    "content": {
        "channel_id": "c8b2d3ce-b0d6-4cd1-9195-fe17a4bd5b8e",
        "start_time": 1738392033699,
        "end_time": 1738392036866,
        "timestamp": 1727384349000000,
        "language": 9,
        "data": "Hi, hello world!"
    }
}
```

| Field        | Type                                          | Description                                                                                                                                                                                                                                           |
| ------------ | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`   | <span class="prop-int">int</span>             | Transcript data sent from the media connection. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type).                                                                                                              |
| `user_id`    | <span class="prop-int">int</span>             | The unique identifier of the participant whose transcript is included.                                                                                                                                                                                |
| `user_name`  | <span class="prop-string">string</span>       | The username of the participant whose transcript is included.                                                                                                                                                                                         |
| `channel_id` | <span class="prop-string">string</span>       | For Zoom Contact Center engagements, the unique identifier of the SIP trunk channel that carries this transcript. Each party in an engagement is on a separate channel, so `channel_id` identifies which side of the call this transcript belongs to. |
| `start_time` | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of when the transcription started.                                                                                                                                                                                                 |
| `end_time`   | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of when the transcription ended.                                                                                                                                                                                                   |
| `timestamp`  | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of the data.                                                                                                                                                                                                                       |
| `language`   | <span class="prop-int">int</span>             | The language of the transcript data. For more information, see [RTMS_TRANSCRIPT_LANGUAGE](/docs/rtms/data-types/#rtms_transcript_language).                                                                                                           |
| `data`       | <span class="prop-string">string</span>       | The transcript data, UTF-8 encoded string.                                                                                                                                                                                                            |

## Chat data

<span className="pill_media">Sent from the media connection</span>

Chat data sent from the media connection. Each participant's chat data is sent in a separate message.

> **Note**
>
> RTMS currently delivers public, or everyone, meeting and webinar chat only (`chat_session.type: 1`). Other chat session types are reserved for future support and aren't delivered to clients today.

```json
{
    "msg_type": 18,
    "content": {
        "timestamp": 1771635627032,
        "data": "Content of the message",
        "chat_session": {
            "type": 1
        },
        "operation_type": 1,
        "message_id": "1-{BAE4D8D3-629A-48E2-9C12-5442D81931BF}",
        "sender": {
            "user_id": 16778240,
            "user_name": "John Smith"
        },
        "files": [
            {
                "file_id": "bJtDzXMnS1ufL1SHarZnMA",
                "file_name": "test.txt",
                "file_size": 28
            }
        ],
        "delete_file_id_list": ["-i81TZFYSK2KUltQP-Y_TA"]
    }
}
```

| Field                 | Type                                           | Description                                                                                                                                                                              |
| --------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`            | <span class="prop-int">int</span>              | Chat data sent from the media connection. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type).                                                       |
| `timestamp`           | <span class="prop-ulong">unsigned long</span>  | The Unix timestamp of the data.                                                                                                                                                          |
| `data`                | <span class="prop-string">string</span>        | The message content. A UTF-8 encoded JSON object string.                                                                                                                                 |
| `chat_session`        | <span class="prop-object">object</span>        | The chat session that the message belongs to.                                                                                                                                            |
| `chat_session.type`   | <span class="prop-int">int</span>              | The type of chat session. RTMS currently only delivers `1` (`EVERYONE`, public chat). For more information, see [RTMS_CHAT_SESSION_TYPE](/docs/rtms/data-types/#rtms_chat_session_type). |
| `operation_type`      | <span class="prop-int">int</span>              | The operation that produced this message, such as send, edit, or delete. For more information, see [RTMS_CHAT_OPERATION_TYPE](/docs/rtms/data-types/#rtms_chat_operation_type).          |
| `message_id`          | <span class="prop-string">string</span>        | The unique identifier of the message.                                                                                                                                                    |
| `sender`              | <span class="prop-object">object</span>        | The participant who sent the message.                                                                                                                                                    |
| `sender.user_id`      | <span class="prop-ulong">unsigned int32</span> | The unique identifier of the participant who sent the message.                                                                                                                           |
| `sender.user_name`    | <span class="prop-string">string</span>        | The username of the participant who sent the message.                                                                                                                                    |
| `files`               | <span class="prop-array">array</span>          | The files attached to the message.                                                                                                                                                       |
| `files[].file_id`     | <span class="prop-string">string</span>        | The unique identifier of the attached file.                                                                                                                                              |
| `files[].file_name`   | <span class="prop-string">string</span>        | The name of the attached file.                                                                                                                                                           |
| `files[].file_size`   | <span class="prop-ulong">unsigned long</span>  | The size of the attached file, in bytes.                                                                                                                                                 |
| `delete_file_id_list` | <span class="prop-array">array</span>          | Optional. The identifiers of files removed while editing a chat message. Only present when files are removed during an edit.                                                             |

## Participant user info

<span className="pill_signaling">Sent from the signaling connection</span>

The signaling connection sends a participant user info event when it observes media data from participants, including audio, video, screen sharing, transcript, or chat. The event lists those participants with their `user_id`, `user_name`, and `participant_uuid`. The signaling connection sends it automatically, so your app doesn't need to subscribe to it.

This event requires protocol V2.

```json
{
    "msg_type": 6,
    "event": {
        "event_code": 4,
        "timestamp": 1793232000000,
        "media_type": 1,
        "participants": [
            {
                "user_id": 16778240,
                "user_name": "Alice",
                "participant_uuid": "C3677EC5-3786-A428-7627-84C3B77B49F8"
            },
            {
                "user_id": 16779264,
                "user_name": "Bob",
                "participant_uuid": "A1248B36-97D2-4E53-AC91-23085F6D7B40"
            }
        ]
    }
}
```

| Field              | Type                                           | Description                                                                                                                                                    |
| ------------------ | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`         | <span class="prop-int">int</span>              | The message type. Always `6` for an event update. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type).                     |
| `event_code`       | <span class="prop-int">int</span>              | The event code. Always `4` for participant user info. For more information, see [RTMS_EVENT_CODE](/docs/rtms/data-types/#rtms_event_code).                     |
| `timestamp`        | <span class="prop-ulong">unsigned long</span>  | The Unix timestamp of the event.                                                                                                                               |
| `media_type`       | <span class="prop-int">int</span>              | The type of media data that the service observed from these participants. For more information, see [MEDIA_DATA_TYPE](/docs/rtms/data-types/#media_data_type). |
| `participants`     | <span class="prop-array">array</span>          | The participants whose media data the service observed. Each participant has the following fields.                                                             |
| `user_id`          | <span class="prop-ulong">unsigned int32</span> | The unique identifier of the participant.                                                                                                                      |
| `user_name`        | <span class="prop-string">string</span>        | The display name of the participant.                                                                                                                           |
| `participant_uuid` | <span class="prop-string">string</span>        | The unique identifier of the participant.                                                                                                                      |

## Session state updated

<span className="pill_signaling">Sent from the signaling connection</span>

The signaling connection sends session state updated events when a new session is added or the state of a session is changed. A session can stop and resume during a stream. This message does not require a response from the app.

The `STARTED` state means a brand-new session has started. Record the session information locally since the state of each session is changed separately.

```json
{
    "msg_type": 9,
    "state": 1,
    "stop_reason": 1,
    "timestamp": 1727384349123,
    "rtms_session_id": "xxxxxxxxxx"
}
```

| Field             | Type                                          | Description                                                                                                                                                                                                              |
| ----------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `msg_type`        | <span class="prop-int">int</span>             | The signaling connection sends this message when a session has been updated. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type).                                                    |
| `state`           | <span class="prop-int">int</span>             | The state of a session within a stream, including if a participant or host has started, paused, resumed or stopped a session. For more information, see [RTMS_SESSION_STATE](/docs/rtms/data-types/#rtms_session_state). |
| `reason`          | <span class="prop-int">int</span>             | Describes why a session status has been updated. It's only sent if session state stops. For more information, see [RTMS_STOP_REASON](/docs/rtms/data-types/#rtms_stop_reason).                                           |
| `timestamp`       | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of when the session was updated.                                                                                                                                                                      |
| `rtms_session_id` | <span class="prop-string">string</span>       | The unique identifier for the RTMS session.                                                                                                                                                                              |

## Session state request

<span className="pill_signaling">Sent to the signaling connection</span>

Apps send the session state request event to the signaling connection to query the current session state. The signaling connection will respond with the current session state.

```json
{
    "msg_type": 10,
    "rtms_session_id": "xxxxxxxxxx"
}
```

| Field             | Type                                    | Description                                                                                                                                                    |
| ----------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`        | <span class="prop-int">int</span>       | The app sends this message to query the current state of the session. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `rtms_session_id` | <span class="prop-string">string</span> | The unique identifier for the RTMS session.                                                                                                                    |

## Session state response

<span className="pill_signaling">Sent from the signaling connection</span>

The signaling connection sends the session state response event in response to a session state request event.

```json
{
    "msg_type": 11,
    "rtms_session_id": "xxxxxxxxxx",
    "state": 1,
    "timestamp": 1727384349123
}
```

| Field             | Type                                          | Description                                                                                                                                                                                         |
| ----------------- | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`        | <span class="prop-int">int</span>             | The signaling connection sends this field as a response to the query for the state of the current session. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `rtms_session_id` | <span class="prop-string">string</span>       | The unique identifier for the RTMS session.                                                                                                                                                         |
| `state`           | <span class="prop-int">int</span>             | The state of the current session. For more information, see [RTMS_SESSION_STATE](/docs/rtms/data-types/#rtms_session_state).                                                                        |
| `timestamp`       | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of the request. Use this to pair requests and responses.                                                                                                                         |

## Stream state request

<span className="pill_signaling">Sent to the signaling connection</span>

Apps send the current stream state request event to the signaling server to query the current stream state. Streams can be in one of the following states: inactive, active, interrupted, terminating, terminated, paused, or resumed.

```json
{
    "msg_type": 19,
    "rtms_stream_id": "756FF58A-6332-6ECA-E4AE-21F2ABDCB485"
}
```

| Field            | Type                                    | Description                                                                                                                                                  |
| ---------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `msg_type`       | <span class="prop-int">int</span>       | The app sends this message to query the current state of the state. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `rtms_stream_id` | <span class="prop-string">string</span> | The unique identifier of the RTMS stream.                                                                                                                    |

## Stream state response

<span className="pill_signaling">Sent from the signaling connection</span>

The signaling connection sends the stream state response event in response to a stream state request event.

```json
{
    "msg_type": 20,
    "state": 1,
    "rtms_stream_id": "756FF58A-6332-6ECA-E4AE-21F2ABDCB485",
    "timestamp": 1694204592
}
```

| Field            | Type                                          | Description                                                                                                                                                                                          |
| ---------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`       | <span class="prop-int">int</span>             | The signaling connection sends this message as a response to the query for the state of the current stream. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `state`          | <span class="prop-int">int</span>             | The current state of the RTMS stream. For more information, see [RTMS_STREAM_STATE](/docs/rtms/data-types/#rtms_stream_state).                                                                       |
| `rtms_stream_id` | <span class="prop-string">string</span>       | The unique identifier for the RTMS stream.                                                                                                                                                           |
| `timestamp`      | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of the request. Use this to pair requests and responses.                                                                                                                          |

## Stream state updated

<span className="pill_signaling">Sent from the signaling connection</span>

```json
{
    "msg_type": 8,
    "state": 1,
    "reason": 1,
    "timestamp": 1727384349123
}
```

| Field       | Type                                          | Description                                                                                                                                                                                                 |
| ----------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`  | <span class="prop-int">int</span>             | The signaling connection sends this message when a stream has been updated. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type).                                        |
| `state`     | <span class="prop-int">int</span>             | The state of a stream, including if a stream is active, experiencing connection issues, or needs to be terminated. For more information, see [RTMS_STREAM_STATE](/docs/rtms/data-types/#rtms_stream_state). |
| `reason`    | <span class="prop-int">int</span>             | Describes why a stream status has been updated. For more information, see [RTMS_STOP_REASON](/docs/rtms/data-types/#rtms_stop_reason).                                                                      |
| `timestamp` | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of when the stream was updated.                                                                                                                                                          |

## Stream close request

<span className="pill_signaling">Sent to the signaling connection</span>

To gracefully close a stream from the app backend, send a `STREAM_CLOSE_REQ` message through the signaling connection. RTMS will respond with a `STREAM_CLOSE_RESP` message and terminate the stream.

```json
{
    "msg_type": 21,
    "rtms_stream_id": "xxxxxxxxxx"
}
```

| Field            | Type                                    | Description                                                                                                                            |
| ---------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`       | <span class="prop-int">int</span>       | The request from the app to close the stream. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `rtms_stream_id` | <span class="prop-string">string</span> | The unique identifier of the RTMS stream to close.                                                                                     |

## Stream close response

<span className="pill_signaling">Sent from the signaling connection</span>

The signaling connection responds to a stream close request with a `STREAM_CLOSE_RESP` message confirming the result.

```json
{
    "msg_type": 22,
    "rtms_stream_id": "xxxxxxxxxx",
    "status_code": 0,
    "reason": "OK",
    "timestamp": 1727384349123
}
```

| Field            | Type                                          | Description                                                                                                                                                       |
| ---------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`       | <span class="prop-int">int</span>             | The response from the signaling connection after a stream close request. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `rtms_stream_id` | <span class="prop-string">string</span>       | The unique identifier of the RTMS stream.                                                                                                                         |
| `status_code`    | <span class="prop-int">int</span>             | The status code of the response. Status `0` means success. For more information, see [RTMS_STATUS_CODE](/docs/rtms/data-types/#rtms_status_code).                 |
| `reason`         | <span class="prop-string">string</span>       | Empty if successful. If failed, contains the reason for the failure.                                                                                              |
| `timestamp`      | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of when the response was sent.                                                                                                                 |

## Video subscription request

<span className="pill_signaling">Sent to the signaling connection</span>

To use individual video subscriptions, configure `data_opt` to `4` (`VIDEO_SINGLE_INDIVIDUAL_STREAM`) when establishing the media connection, and subscribe to `PARTICIPANT_VIDEO_ON` and `PARTICIPANT_VIDEO_OFF` events using the [Subscribe to events](#subscribe-to-events) message.

To subscribe to an individual participant's video stream, send this message through the signaling connection containing the `user_id` obtained from a `PARTICIPANT_VIDEO_ON` event. The RTMS server supports subscribing to a single individual video stream at a time, a new subscription request will automatically unsubscribe from the previous individual's stream.

```json
{
    "msg_type": 28,
    "user_id": 16778240,
    "subscribe": true,
    "timestamp": 1738392033699
}
```

| Field       | Type                                           | Description                                                                                                                                                                      |
| ----------- | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`  | <span class="prop-int">int</span>              | The request from the app to subscribe or unsubscribe from an individual's video stream. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `user_id`   | <span class="prop-ulong">unsigned int32</span> | The unique identifier of the participant to subscribe to, obtained from a `PARTICIPANT_VIDEO_ON` event.                                                                          |
| `subscribe` | <span class="prop-bool">bool</span>            | Set to `true` to subscribe, `false` to unsubscribe.                                                                                                                              |
| `timestamp` | <span class="prop-ulong">unsigned long</span>  | The Unix timestamp of the request.                                                                                                                                               |

## Video subscription response

<span className="pill_signaling">Sent from the signaling connection</span>

The signaling connection responds to a video subscription request. If successful, the subscribed participant's video stream will begin transmitting through the video data socket connection.

```json
{
    "msg_type": 29,
    "user_id": 16778240,
    "status_code": 0,
    "reason": "OK",
    "timestamp": 1738392033699
}
```

| Field         | Type                                           | Description                                                                                                                                                             |
| ------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`    | <span class="prop-int">int</span>              | The response from the signaling connection after a video subscription request. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `user_id`     | <span class="prop-ulong">unsigned int32</span> | The unique identifier of the participant that was subscribed or unsubscribed.                                                                                           |
| `status_code` | <span class="prop-int">int</span>              | The status code of the response. Status `0` means success. For more information, see [RTMS_STATUS_CODE](/docs/rtms/data-types/#rtms_status_code).                       |
| `reason`      | <span class="prop-string">string</span>        | Empty if successful. If failed, contains the reason for the failure.                                                                                                    |
| `timestamp`   | <span class="prop-ulong">unsigned long</span>  | The Unix timestamp of the response.                                                                                                                                     |

## Request error response

<span className="pill_signaling">Sent from the signaling connection</span>

To find out why the signaling connection rejected a request, read the request error response. Use `request_msg_type` to match the error to the request that caused it, and use `status_code` and `reason` to find the cause.

The signaling connection sends this message only for invalid requests. It doesn't send a response to a valid subscribe or unsubscribe request. For more information, see [Subscribe to events](/docs/rtms/event-reference/universal-events/#subscribe-to-events).

```json
{
    "msg_type": 30,
    "request_msg_type": 5,
    "status_code": 6,
    "reason": "<reason for the failure>",
    "timestamp": 1738392033699
}
```

| Field              | Type                                          | Description                                                                                                                                          |
| ------------------ | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `msg_type`         | <span class="prop-int">int</span>             | The message type. Always `30` for a request error response. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type). |
| `request_msg_type` | <span class="prop-int">int</span>             | The `msg_type` of the request that failed. For more information, see [RTMS_MESSAGE_TYPE](/docs/rtms/data-types/#rtms_message_type).                  |
| `status_code`      | <span class="prop-int">int</span>             | The reason the request failed. For more information, see [RTMS_STATUS_CODE](/docs/rtms/data-types/#rtms_status_code).                                |
| `reason`           | <span class="prop-string">string</span>       | A description of the failure.                                                                                                                        |
| `timestamp`        | <span class="prop-ulong">unsigned long</span> | The Unix timestamp of the response.                                                                                                                  |

A subscribe request that includes both `event_code` and `event_type` in the same entry returns status `6`. For more information, see [Subscribe to events](/docs/rtms/event-reference/universal-events/#subscribe-to-events).
