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

> 订阅以在验证器设置新根时接收通知。

## 端点

主网和 devnet 上可用 Websockets，使用以下 URL：

* **Mainnet** `wss://mainnet.helius-rpc.com/?api-key=<api-key>`
* **Devnet** `wss://devnet.helius-rpc.com/?api-key=<api-key>`

<Note>Websockets 有 10 分钟的不活动计时器；强烈建议实施健康检查并每分钟发送 ping 以保持 websocket 连接活跃。</Note>

## 授权

<ParamField query="api-key" type="string" required>
  您的 Helius API 密钥。您可以在[仪表板](https://dashboard.helius.dev/api-keys)上免费获取一个。
</ParamField>

## 正文

<ParamField body="params" type="array">
  <Expandable title="properties" 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>
