> ## Documentation Index
> Fetch the complete documentation index at: https://www.helius.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# accountSubscribe

> 주어진 계정 공개 키에 대한 lamports 또는 데이터가 변경될 때 알림을 받기 위해 계정을 구독합니다.

## 엔드포인트

웹소켓은 다음 URL을 통해 메인넷과 개발넷에서 사용할 수 있습니다:

* **메인넷** `wss://mainnet.helius-rpc.com/?api-key=<api-key>`
* **개발넷** `wss://devnet.helius-rpc.com/?api-key=<api-key>`

<Note>웹소켓에는 10분의 비활성 타이머가 있으며, 웹소켓 연결을 유지하기 위해 건강 검사를 구현하고 매분 핑을 보내는 것이 강력히 권장됩니다.</Note>

## 권한

<ParamField query="api-key" type="string" required>
  귀하의 Helius API 키입니다. [대시보드](https://dashboard.helius.dev/api-keys)에서 무료로 얻을 수 있습니다.
</ParamField>

## 본문

<ParamField body="params" type="array" required>
  <Expandable title="properties" defaultOpen>
    <ParamField body="pubkey" type="string" required>
      Base-58로 인코딩된 계정 공개 키입니다.
    </ParamField>

    <ParamField body="encoding" type="string">
      계정 데이터의 인코딩 형식입니다. `base58`, `base64`, `base64+zstd` 또는 `jsonParsed`일 수 있습니다.

      * `base58`는 느립니다
      * `jsonParsed` 인코딩은 프로그램별 상태 파서를 사용하여 보다 인간 친화적이고 명시적인 계정 상태 데이터를 반환하려고 시도합니다
      * `jsonParsed`이 요청되었지만 파서를 찾을 수 없는 경우, 필드는 문자열 타입의 데이터를 가질 때 이진 인코딩으로 되돌아갑니다.
    </ParamField>

    <ParamField body="commitment" type="string">
      구독의 커밋 수준입니다. `finalized`, `confirmed`, 또는 `processed`일 수 있습니다.
    </ParamField>

    <ParamField body="notifyOn" type="string">
      Helius 전용 확장입니다. `lock` (기본값) 또는 `write`일 수 있습니다.

      * `lock`은 거래가 계정에 실제로 기록되지 않더라도 거래가 계정을 쓰기 잠금할 때마다 알림을 보냅니다
      * `write`는 거래가 계정에 실제로 기록될 때만 알림을 보내며, 바쁜 계정에 대한 중복 무효 업데이트를 줄입니다. 동일한 데이터를 쓰는 경우에도 기록으로 간주되어 전달됩니다
      * 인식되지 않는 값은 `lock`로 되돌아갑니다

      자세한 내용은 [notifyOn 필터링](/docs/ko/rpc/websocket/notify-on-filtering)을 참조하세요.
    </ParamField>
  </Expandable>
</ParamField>

## 응답

<ResponseField name="result" type="integer">
  구독 ID(구독 해지 필요)
</ResponseField>

<RequestExample>
  ```json Request theme={"system"}
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "accountSubscribe",
    "params": [
      "CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12",
      {
        "encoding": "jsonParsed",
        "commitment": "finalized"
      }
    ]
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={"system"}
  {
    "jsonrpc": "2.0",
    "result": 23784,
    "id": 1
  }
  ```

  ```json Message (base58) theme={"system"}
  {
    "jsonrpc": "2.0",
    "method": "accountNotification",
    "params": {
      "result": {
        "context": {
          "slot": 5199307
        },
        "value": {
          "data": [
            "11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHPXHRDEHrBesJhZyqnnq9qJeUuF7WHxiuLuL5twc38w2TXNLxnDbjmuR",
            "base58"
          ],
          "executable": false,
          "lamports": 33594,
          "owner": "11111111111111111111111111111111",
          "rentEpoch": 635,
          "space": 80
        }
      },
      "subscription": 23784
    }
  }
  ```

  ```json Message (jsonParsed) theme={"system"}
  {
    "jsonrpc": "2.0",
    "method": "accountNotification",
    "params": {
      "result": {
        "context": {
          "slot": 5199307
        },
        "value": {
          "data": {
            "program": "nonce",
            "parsed": {
              "type": "initialized",
              "info": {
                "authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX",
                "blockhash": "LUaQTmM7WbMRiATdMMHaRGakPtCkc2GHtH57STKXs6k",
                "feeCalculator": {
                  "lamportsPerSignature": 5000
                }
              }
            }
          },
          "executable": false,
          "lamports": 33594,
          "owner": "11111111111111111111111111111111",
          "rentEpoch": 635,
          "space": 80
        }
      },
      "subscription": 23784
    }
  }
  ```
</ResponseExample>
