> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# WebSocket RPC Methods

> Real-time WebSocket subscriptions for monitoring blockchain state changes

Real-time WebSocket subscriptions for monitoring blockchain state changes. Connect to `ws://127.0.0.1:8900` when running Surfnet. Surfnet implements `accountSubscribe`, `logsSubscribe`, `programSubscribe`, `signatureSubscribe` and `slotSubscribe`; `blockSubscribe`, `voteSubscribe` and `slotUpdatesSubscribe` are listed for completeness but are not supported. In every notification the payload is wrapped in `params.result`, next to the `subscription` id.

## accountSubscribe

Account subscribe endpoint specification

**Parameters**

<ParamField body="pubkey" type="string" required>
  Account public key to monitor (base-58 encoded)
</ParamField>

<ParamField body="config" type="RpcAccountSubscribeConfig">
  Optional subscription configuration
</ParamField>

```json Subscribe
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "accountSubscribe",
  "params": [
    "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
    {
      "commitment": "confirmed",
      "encoding": "base64"
    }
  ]
}
```

```json title="Subscribe response"
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 12345
}
```

```json Notification
{
  "jsonrpc": "2.0",
  "method": "accountNotification",
  "params": {
    "result": {
      "context": {
        "slot": 457254896,
        "apiVersion": "4.2.1"
      },
      "value": {
        "lamports": 2000000000,
        "data": [
          "",
          "base64"
        ],
        "owner": "11111111111111111111111111111111",
        "executable": false,
        "rentEpoch": 0,
        "space": 0
      }
    },
    "subscription": 12345
  }
}
```

```json accountUnsubscribe
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "accountUnsubscribe",
  "params": [
    12345
  ]
}
```

```json title="accountUnsubscribe response"
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
```

## blockSubscribe

blockSubscribe - Subscribe to block updates

**Not supported by Surfnet.** blockSubscribe is rejected (or not found) by the Surfnet WebSocket server. It is listed because it is part of the Solana RPC API.

## logsSubscribe

logsSubscribe - Subscribe to transaction logs

```json Subscribe
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "logsSubscribe",
  "params": [
    "all",
    {
      "commitment": "confirmed"
    }
  ]
}
```

```json title="Subscribe response"
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 12345
}
```

```json Notification
{
  "jsonrpc": "2.0",
  "method": "logsNotification",
  "params": {
    "result": {
      "context": {
        "slot": 457254896,
        "apiVersion": "4.2.1"
      },
      "value": {
        "signature": "3Vgn9jbnyRU48EHSbD47wXLDNV17vzcArFdmZAiN2NjGLpgvsRtkdgR8h5FnHj4ghWDD6nkxq78kPra2c5Gghijo",
        "err": null,
        "logs": [
          "Program 11111111111111111111111111111111 invoke [1]",
          "Program 11111111111111111111111111111111 success"
        ]
      }
    },
    "subscription": 12345
  }
}
```

```json logsUnsubscribe
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "logsUnsubscribe",
  "params": [
    12345
  ]
}
```

```json title="logsUnsubscribe response"
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
```

## programSubscribe

programSubscribe - Subscribe to program account changes

```json Subscribe
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "programSubscribe",
  "params": [
    "11111111111111111111111111111111",
    {
      "commitment": "confirmed",
      "encoding": "base64"
    }
  ]
}
```

```json title="Subscribe response"
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 12345
}
```

```json Notification
{
  "jsonrpc": "2.0",
  "method": "programNotification",
  "params": {
    "result": {
      "context": {
        "slot": 457254896,
        "apiVersion": "4.2.1"
      },
      "value": {
        "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
        "account": {
          "lamports": 2000000000,
          "data": [
            "",
            "base64"
          ],
          "owner": "11111111111111111111111111111111",
          "executable": false,
          "rentEpoch": 0,
          "space": 0
        }
      }
    },
    "subscription": 12345
  }
}
```

```json programUnsubscribe
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "programUnsubscribe",
  "params": [
    12345
  ]
}
```

```json title="programUnsubscribe response"
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
```

## signatureSubscribe

Signature subscribe endpoint specification

**Parameters**

<ParamField body="signature" type="string" required>
  Transaction signature to monitor (base-58 encoded)
</ParamField>

<ParamField body="config" type="RpcSignatureSubscribeConfig">
  Optional subscription configuration
</ParamField>

```json Subscribe
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "signatureSubscribe",
  "params": [
    "3Vgn9jbnyRU48EHSbD47wXLDNV17vzcArFdmZAiN2NjGLpgvsRtkdgR8h5FnHj4ghWDD6nkxq78kPra2c5Gghijo",
    {
      "commitment": "confirmed"
    }
  ]
}
```

```json title="Subscribe response"
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 12345
}
```

```json Notification
{
  "jsonrpc": "2.0",
  "method": "signatureNotification",
  "params": {
    "result": {
      "context": {
        "slot": 457254448,
        "apiVersion": "4.2.1"
      },
      "value": {
        "err": null
      }
    },
    "subscription": 12345
  }
}
```

```json signatureUnsubscribe
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "signatureUnsubscribe",
  "params": [
    12345
  ]
}
```

```json title="signatureUnsubscribe response"
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
```

## slotSubscribe

Slot subscribe endpoint specification

```json Subscribe
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "slotSubscribe",
  "params": []
}
```

```json title="Subscribe response"
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": 12345
}
```

```json Notification
{
  "jsonrpc": "2.0",
  "method": "slotNotification",
  "params": {
    "result": {
      "slot": 457254897,
      "parent": 457254896,
      "root": 457254866
    },
    "subscription": 12345
  }
}
```

```json slotUnsubscribe
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "slotUnsubscribe",
  "params": [
    12345
  ]
}
```

```json title="slotUnsubscribe response"
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
```

## slotUpdatesSubscribe

slotUpdatesSubscribe - Subscribe to slot updates

**Not supported by Surfnet.** slotUpdatesSubscribe is rejected (or not found) by the Surfnet WebSocket server. It is listed because it is part of the Solana RPC API.

## voteSubscribe

voteSubscribe - Subscribe to vote account updates

**Not supported by Surfnet.** voteSubscribe is rejected (or not found) by the Surfnet WebSocket server. It is listed because it is part of the Solana RPC API.
