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

# slotSubscribe

> Đăng ký để nhận thông báo bất cứ khi nào một slot được trình xác thực xử lý.

## Điểm cuối

WebSocket có sẵn trên mainnet và devnet với các URL sau:

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

<Note>WebSocket có bộ hẹn giờ không hoạt động trong 10 phút; bạn nên triển khai quy trình kiểm tra trạng thái và gửi ping mỗi phút để duy trì kết nối WebSocket.</Note>

## Xác thực

<ParamField query="api-key" type="string" required>
  Khóa API Helius của bạn. Bạn có thể nhận khóa miễn phí trong [bảng điều khiển](https://dashboard.helius.dev/api-keys).
</ParamField>

## Nội dung yêu cầu

<ParamField body="params" type="array">
  <Expandable title="properties" defaultOpen>
    <ParamField body="none" type="null">
      Không yêu cầu tham số.
    </ParamField>
  </Expandable>
</ParamField>

## Phản hồi

<ResponseField name="result" type="integer">
  ID đăng ký (cần thiết để hủy đăng ký)
</ResponseField>

## Định dạng thông báo

Thông báo sẽ là một đối tượng có các trường sau:

* `parent: <u64>` - Slot cha
* `root: <u64>` - Slot gốc hiện tại
* `slot: <u64>` - Giá trị slot mới được thiết lập

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

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

  ```json Notification theme={"system"}
  {
    "jsonrpc": "2.0",
    "method": "slotNotification",
    "params": {
      "result": {
        "parent": 75,
        "root": 44,
        "slot": 76
      },
      "subscription": 0
    }
  }
  ```
</ResponseExample>
