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

# voteSubscribe

> ゴシップ内で新しい投票が観測されるたびに通知を受け取るために購読します。これらの投票はコンセンサス前のものであるため、これらの投票が元帳に入る保証はありません。

<Note>
  このサブスクリプションは不安定であり、バリデーターが `--rpc-pubsub-enable-vote-subscription` フラグを使用して開始された場合にのみ利用可能です。このサブスクリプションの形式は将来変更される可能性があります。
</Note>

<Warning>
  これは不安定な RPC メソッドであり、**Helius はサポートしていません**。このドキュメントは参照用に提供されています。
</Warning>

## エンドポイント

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

## 認可

<ParamField query="api-key" type="string" required>
  あなたの Helius API キー。無料で [dashboard](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>

## 通知フォーマット

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

* `hash: <string>` - 投票ハッシュ
* `slots: <array>` - 投票によってカバーされたスロット、u64 整数の配列として
* `timestamp: <i64|null>` - 投票のタイムスタンプ
* `signature: <string>` - この投票を含むトランザクションの署名
* `votePubkey: <string>` - 投票アカウントの公開鍵、base-58 エンコードされた文字列として

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

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

  ```json Notification theme={"system"}
  {
    "jsonrpc": "2.0",
    "method": "voteNotification",
    "params": {
      "result": {
        "hash": "8Rshv2oMkPu5E4opXTRyuyBeZBqQ4S477VG26wUTFxUM",
        "slots": [1, 2],
        "timestamp": null
      },
      "subscription": 0
    }
  }
  ```
</ResponseExample>
