> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/contributor/contributor-ko/communications/messages.md).

# 메시지

통신의 메시지는 이진 데이터 *패킷*, 프로토콜 버퍼를 사용하여 직렬화됩니다 [프로토콜 버퍼](https://github.com/protocolbuffers/protobuf). 텍스트 및 음성 채팅, 위치 업데이트, 프로필 변경 및 기타 실시간 상호작용을 전달합니다.

{% hint style="info" %}
오픈 소스를 사용해 통신 프로토콜이 실제로 동작하는 모습을 보고 직접 실험해 볼 수 있습니다 [Comms Station](https://decentraland.github.io/comms-station/).
{% endhint %}

모든 메시지 정의는 다음에서 확인할 수 있습니다 [프로토콜 저장소에 정의된 대로](https://github.com/decentraland/protocol), 그리고 아래의 각 메시지 유형에는 해당 선언으로 연결되는 링크가 있습니다.

**`Packet`** [**↗ 소스**](https://github.com/decentraland/protocol/blob/c48ea0aa00d8173084571552463a6a05a7f49636/proto/decentraland/kernel/comms/rfc4/comms.proto#L8)

그 `Packet` 구조는 모든 메시지를 담는 컨테이너입니다.

| 필드    | 타입    | 값                                                                                                                                                                                                  |
| ----- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `메시지` | `열거형` | <p>다음 중 하나 <code>Chat</code>, <code>Voice</code>, <code>Position</code>, <code>AnnounceProfileVersion</code>,<br><code>ProfileRequest</code>, <code>ProfileResponse</code>, 또는 <code>씬</code>.</p> |

### 텍스트 및 음성 채팅

클라이언트는 연결된 모든 피어(보통 같은 섬에 있는 플레이어)에게 텍스트 메시지와 오디오 클립을 브로드캐스트하여 채팅합니다.

두 개의 `Packet` 유형이 관련되며, 사용 사례마다 하나씩 있습니다. 일반적으로 클라이언트는 이 메시지들을 같은 섬에 있는 다른 모든 클라이언트에게 브로드캐스트합니다. 섬은 서로 상호작용할 수 있는 인근 플레이어들의 그룹입니다.

***

**`Chat`** [**↗ 소스**](https://github.com/decentraland/protocol/blob/c48ea0aa00d8173084571552463a6a05a7f49636/proto/decentraland/kernel/comms/rfc4/comms.proto#L56)

다른 클라이언트에게 텍스트 채팅 메시지를 보냅니다.

| 필드      | 타입       | 값                |
| ------- | -------- | ---------------- |
| `메시지`   | `string` | 메시지의 텍스트         |
| `타임스탬프` | `double` | 보낸 사람의 UTC 타임스탬프 |

***

**`Voice`** [**↗ 소스**](https://github.com/decentraland/protocol/blob/c48ea0aa00d8173084571552463a6a05a7f49636/proto/decentraland/kernel/comms/rfc4/comms.proto#L66)

인코딩된 음성 샘플을 다른 클라이언트에게 보냅니다.

| 필드                | 타입       | 값                                     |
| ----------------- | -------- | ------------------------------------- |
| `encoded_samples` | `bytes`  | 인코딩된 오디오 데이터                          |
| `코덱`              | `열거형`    | 오직 `VC_OPUS` (현재로서는 다른 코덱은 지원되지 않습니다) |
| `index`           | `uint32` | 보낸 사람이 설정하는 증가 카운터                    |

그 `코덱` 필드는 하나의 `열거형` 값입니다. 사용자 정의 코덱은 지원되지 않습니다.

### 이동

아바타를 제어하는 클라이언트는 플레이어 간의 이동과 자세를 동기화하기 위해, 자신의 섬 내에서 위치 업데이트를 보내고 받습니다.

***

**`Position`** [**↗ 소스**](https://github.com/decentraland/protocol/blob/c48ea0aa00d8173084571552463a6a05a7f49636/proto/decentraland/kernel/comms/rfc4/comms.proto#L20)

아바타의 위치와 방향을 다른 클라이언트에게 업데이트합니다.

| 필드                                                                                                                  | 타입       | 값                  |
| ------------------------------------------------------------------------------------------------------------------- | -------- | ------------------ |
| <p><code>position\_x</code><br><code>position\_y</code><br><code>position\_z</code></p>                             | `float`  | 월드 맵에서의 아바타 위치     |
| <p><code>rotation\_x</code><br><code>rotation\_y</code><br><code>rotation\_z</code><br><code>rotation\_w</code></p> | `float`  | 아바타 회전 쿼터니언        |
| `index`                                                                                                             | `uint32` | 보낸 사람이 설정하는 증가 카운터 |

클라이언트는 일반적으로 `Position` 업데이트를 낮은 빈도로(예: 1\~2초에 한 번) 보내며, 이동하거나 상호작용할 때는 높은 빈도(초당 여러 번)로 전환합니다.

{% hint style="info" %}
위치 업데이트를 보낼 때는 보통 신뢰성보다 속도가 더 중요합니다. 전달이 더 빠르다면, `Position` 메시지가 가끔 손실되거나 순서가 바뀌어도 체감 성능이 더 좋습니다. 일부 전송 방식(예: [LiveKit](https://github.com/decentraland/docs/tree/main/contributor/communications/transport-types/livekit/README.md))은 메시지별로 빠른 모드와 신뢰성 모드 사이를 전환할 수 있습니다.
{% endhint %}

낮은 빈도의 브로드캐스트는 섬에 합류하는 동안 잠시 연결이 끊기거나 메시지를 놓친 클라이언트에게 업데이트를 전달하기 위한 간단한 해결책으로 권장됩니다.

그 `index` 필드는 보낸 사람이 설정하는 증가 카운터이며, 수신자가 순서가 뒤바뀌어 도착한 업데이트를 정렬할 수 있게 합니다.

### 프로필 공유

섬 내의 클라이언트는 다른 플레이어의 아바타 정보를 요청하여, 자신의 아바타를 렌더링하고 이름과 사진 등을 표시할 수 있습니다.

프로필 변경은(예를 들어 위치 업데이트에 비해) 드물기 때문에, 이 시스템은 로컬 프로필 캐시를 유지하는 작업을 단순화하고 필요할 때만 프로필을 가져오도록 설계되었습니다.

3개의 [`Packet`](#Packet) 유형이 관련됩니다: [`ProfileRequest`](#ProfileRequest)/[`ProfileResponse`](#ProfileResponse) 클라이언트가 필요할 때 프로필을 공유하는 데 사용하는 한 쌍과, [`AnnounceProfileVersion`](#AnnounceProfileVersion) 최신 버전이 무엇인지 피어에게 알려 주는 메시지로, 피어가 요청할지 여부를 결정할 수 있게 합니다.

클라이언트는 일반적으로 `AnnounceProfileVersion` 메시지를 주기적으로 브로드캐스트하고, 프로필이 변경되면 즉시 브로드캐스트합니다.

```mermaid
sequenceDiagram
    participant Client1 as Client 1
    participant Client2 as Client 2
    participant Client3 as Client 3
    
    Client1에 대한 참고: 프로필 버전 브로드캐스트
    Client1->>Client1: AnnounceProfileVersion(v1)
    Client1->>Client1: AnnounceProfileVersion(v1)
    
    Client3에 대한 참고: 프로필 요청
    Client3->>Client1: ProfileRequest(@client 1)
    Client1->>Client3: ProfileResponse(v1)
    
    Client1->>Client1: AnnounceProfileVersion(v1)
    
    Client1에 대한 참고: 프로필 업데이트
    Client1->>Client1: AnnounceProfileVersion(v2)
    
    Client2,Client3에 대한 참고: 여러 클라이언트가 요청
    Client2->>Client1: ProfileRequest(@client 1)
    Client3->>Client1: ProfileRequest(@client 1)
    Client1->>Client2: ProfileResponse(v2)
    Client1->>Client3: ProfileResponse(v2)
```

***

**`AnnounceProfileVersion`** [**↗ 소스**](https://github.com/decentraland/protocol/blob/c48ea0aa00d8173084571552463a6a05a7f49636/proto/decentraland/kernel/comms/rfc4/comms.proto#L34)

다른 클라이언트에게 다음이 있음을 알립니다. [프로필 엔터티](https://github.com/decentraland/docs/tree/main/contributor/content/entity-types/profiles/README.md) 요청할 수 있습니다.

| 필드                | 타입       | 값                         |
| ----------------- | -------- | ------------------------- |
| `profile_version` | `uint32` | 수정이 있을 때마다 증가하는 버전 번호입니다. |

프로필을 캐시하는 수신자는 `profile_version` 번호를 사용해 로컬 사본이 최신인지, 아니면 [`ProfileRequest`](#ProfileRequest).

***

**`ProfileRequest`** [**↗ 소스**](https://github.com/decentraland/protocol/blob/c48ea0aa00d8173084571552463a6a05a7f49636/proto/decentraland/kernel/comms/rfc4/comms.proto#L41)

특정 피어에게 지정한 버전의 프로필을 요청합니다.

| 필드                | 타입       | 값                |
| ----------------- | -------- | ---------------- |
| `address`         | string   | 프로필을 식별하는 주소입니다. |
| `profile_version` | `uint32` | 원하는 프로필 버전입니다.   |

수신자는 [`ProfileResponse`](#ProfileResponse) 메시지로 요청된 프로필을 제공할 수 있습니다.

***

**`ProfileResponse`** [**↗ 소스**](https://github.com/decentraland/protocol/blob/c48ea0aa00d8173084571552463a6a05a7f49636/proto/decentraland/kernel/comms/rfc4/comms.proto#L46)

에 대한 응답으로 프로필을 보냅니다. [`ProfileRequest`](#ProfileRequest).

| 필드                   | 타입       | 값                                    |
| -------------------- | -------- | ------------------------------------ |
| `serialized_profile` | string   | JSON으로 직렬화된 프로필 엔터티.                 |
| `base_url`           | `uint32` | 보낸 사람이 권장하는 파일 시스템 엔드포인트의 기본 URL입니다. |

그 `serialized_profile` 필드에는 다음의 JSON 직렬화가 포함됩니다. [프로필 엔터티](https://github.com/decentraland/docs/tree/main/contributor/content/entity-types/profiles/README.md).

보낸 사람이 프로필에서 참조된 엔터티(예: 착용 아이템)를 다운로드할 콘텐츠 서버를 추천하고 싶다면, `base_url` 필드를 힌트로 설정할 수 있습니다. 클라이언트는 이 URL을 사용하거나 무시할 수 있습니다.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/contributor/contributor-ko/communications/messages.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
