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

# slotsUpdatesSubscribe

> 各スロットのさまざまな更新に関するバリデーターからの通知を受け取るためにサブスクライブします。

<Note>
  このサブスクリプションは不安定です。将来的にフォーマットが変更される可能性があり、常にサポートされるとは限りません。
</Note>

## エンドポイント

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

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

<Note>Websocketは10分間の非アクティビティタイマーがあります。Websocketの接続を維持するために、ヘルスチェックを実装し、毎分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="properties" defaultOpen>
    <ParamField body="none" type="null">
      パラメータは必要ありません。
    </ParamField>
  </Expandable>
</ParamField>

## 応答

<ResponseField name="result" type="integer">
  サブスクリプションID（サブスクライブ解除に必要）
</ResponseField>

## 通知フォーマット

通知は次のフィールドを持つオブジェクトになります：

* `err: <string|undefined>` - エラーメッセージ。更新が "dead" タイプの場合のみ存在します。
* `parent: <u64|undefined>` - 親スロット。更新が "createdBank" タイプの場合のみ存在します。
* `slot: <u64>` - 新たに更新されたスロット
* `stats: <object|undefined>` - 更新が "frozen" タイプの場合のみ存在します。次のフィールドを持つオブジェクト：
  * `maxTransactionsPerEntry: <u64>`
  * `numFailedTransactions: <u64>`
  * `numSuccessfulTransactions: <u64>`
  * `numTransactionEntries: <u64>`
* `timestamp: <i64>` - 更新のUnixタイムスタンプ（ミリ秒単位）
* `type: <string>` - 更新タイプ、以下のいずれか：
  * "firstShredReceived"
  * "completed"
  * "createdBank"
  * "frozen"
  * "dead"
  * "optimisticConfirmation"
  * "root"

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

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

  ```json Notification theme={"system"}
  {
    "jsonrpc": "2.0",
    "method": "slotsUpdatesNotification",
    "params": {
      "result": {
        "parent": 75,
        "slot": 76,
        "timestamp": 1625081266243,
        "type": "optimisticConfirmation"
      },
      "subscription": 0
    }
  }
  ```
</ResponseExample>
