> ## 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.

# rootSubscribe

> バリデーターによって新しいルートが設定されるたびに通知を受け取るために購読します。

## エンドポイント

メインネットとデブネットで次のURLでWebsocketsが利用可能です:

* **メインネット** `wss://mainnet.helius-rpc.com/?api-key=<api-key>`
* **デブネット** `wss://devnet.helius-rpc.com/?api-key=<api-key>`

<Note>Websocketsには10分の非アクティブタイマーがあります。接続を維持するためにヘルスチェックの実装と毎分pingを送信することを強くお勧めします。</Note>

## 認証

<ParamField query="api-key" type="string" required>
  あなたのHelius APIキー。無料で[ダッシュボード](https://dashboard.helius.dev/api-keys)で取得できます。
</ParamField>

## 本文

<ParamField body="params" type="array">
  <Expandable title="プロパティ" defaultOpen>
    <ParamField body="none" type="null">
      パラメーターは必要ありません。
    </ParamField>
  </Expandable>
</ParamField>

## レスポンス

<ResponseField name="result" type="integer">
  購読ID（購読解除に必要）
</ResponseField>

## 通知形式

結果は最新のルートスロット番号です。

<RequestExample>
  ```json Request theme={"system"}
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "rootSubscribe"
  }
  ```
</RequestExample>

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

  ```json Notification theme={"system"}
  {
    "jsonrpc": "2.0",
    "method": "rootNotification",
    "params": {
      "result": 42,
      "subscription": 0
    }
  }
  ```
</ResponseExample>
