Skip to main content

Rpc

Trait Rpc 

Source
pub trait Rpc:
    Sized
    + Send
    + Sync
    + 'static {
    type Metadata: PubSubMetadata;

Show 21 methods // Required methods fn signature_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<RpcSignatureResult>>, signature_str: String, config: Option<RpcSignatureSubscribeConfig>, ); fn signature_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>; fn account_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<UiAccount>>, pubkey_str: String, config: Option<RpcAccountSubscribeConfig>, ); fn account_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>; fn slot_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<SlotInfo>, ); fn slot_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>; fn logs_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<RpcLogsResponse>>, mentions: Option<RpcTransactionLogsFilter>, commitment: Option<CommitmentConfig>, ); fn logs_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>; fn root_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<()>>, ); fn root_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>; fn program_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<RpcKeyedAccount>>, pubkey_str: String, config: Option<RpcProgramSubscribeConfig>, ); fn program_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>; fn slots_updates_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<Arc<SlotUpdate>>, ); fn slots_updates_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>; fn block_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<()>>, ); fn block_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>; fn vote_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<()>>, ); fn vote_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>; fn snapshot_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<SnapshotImportNotification>, snapshot_url: String, ); fn snapshot_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>; // Provided method fn to_delegate(self) -> IoDelegate<Self, Self::Metadata> { ... }
}

Required Associated Types§

Required Methods§

Source

fn signature_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<RpcSignatureResult>>, signature_str: String, config: Option<RpcSignatureSubscribeConfig>, )

Subscribe to signature status notifications via WebSocket.

This method allows clients to subscribe to status updates for a specific transaction signature. The subscriber will receive notifications when the transaction reaches the desired confirmation level or when it’s initially received by the network (if configured).

§Parameters
  • meta: WebSocket metadata containing RPC context and connection information.
  • subscriber: The subscription sink for sending signature status notifications to the client.
  • signature_str: The transaction signature to monitor, as a base-58 encoded string.
  • config: Optional configuration specifying commitment level and notification preferences.
§Returns

This method does not return a value directly. Instead, it establishes a WebSocket subscription that will send RpcResponse<RpcSignatureResult> notifications to the subscriber when the transaction status changes.

§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "signatureSubscribe",
  "params": [
    "2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8rkxwPYPe8cSwE5GzhEgJA2y8fVjDEo6iR6ykBvDxrTQrtpb",
    {
      "commitment": "finalized",
      "enableReceivedNotification": false
    }
  ]
}
§Example WebSocket Response (Subscription Confirmation)
{
  "jsonrpc": "2.0",
  "result": 0,
  "id": 1
}
§Example WebSocket Notification
{
  "jsonrpc": "2.0",
  "method": "signatureNotification",
  "params": {
    "result": {
      "context": {
        "slot": 5207624
      },
      "value": {
        "err": null
      }
    },
    "subscription": 0
  }
}
§Notes
  • If the transaction already exists with the desired confirmation status, the subscriber will be notified immediately and the subscription will complete.
  • The subscription automatically terminates after sending the first matching notification.
  • Invalid signature formats will cause the subscription to be rejected with an error.
  • Each subscription runs in its own async task for optimal performance.
§See Also
  • signatureUnsubscribe: Remove an active signature subscription
  • getSignatureStatuses: Get current status of multiple signatures
Source

fn signature_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>

Unsubscribe from signature status notifications.

This method removes an active signature subscription, stopping further notifications for the specified subscription ID.

§Parameters
  • meta: Optional WebSocket metadata containing connection information.
  • subscription: The subscription ID to remove, as returned by signatureSubscribe.
§Returns

A Result<bool> indicating whether the unsubscription was successful:

  • Ok(true) if the subscription was successfully removed
  • Err(Error) with InvalidParams if the subscription ID doesn’t exist
§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "signatureUnsubscribe",
  "params": [0]
}
§Example WebSocket Response
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}
§Notes
  • Attempting to unsubscribe from a non-existent subscription will return an error.
  • Successfully unsubscribed connections will no longer receive notifications.
  • This method is thread-safe and can be called concurrently.
§See Also
  • signatureSubscribe: Create a signature status subscription
Source

fn account_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<UiAccount>>, pubkey_str: String, config: Option<RpcAccountSubscribeConfig>, )

Subscribe to account change notifications via WebSocket.

This method allows clients to subscribe to updates for a specific account. The subscriber will receive notifications whenever the account’s data, lamports balance, ownership, or other properties change.

§Parameters
  • meta: WebSocket metadata containing RPC context and connection information.
  • subscriber: The subscription sink for sending account update notifications to the client.
  • pubkey_str: The account public key to monitor, as a base-58 encoded string.
  • config: Optional configuration specifying commitment level and encoding format for account data.
§Returns

This method does not return a value directly. Instead, it establishes a continuous WebSocket subscription that will send RpcResponse<UiAccount> notifications to the subscriber whenever the account state changes.

§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "accountSubscribe",
  "params": [
    "CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12",
    {
      "commitment": "finalized",
      "encoding": "base64"
    }
  ]
}
§Example WebSocket Response (Subscription Confirmation)
{
  "jsonrpc": "2.0",
  "result": 23784,
  "id": 1
}
§Example WebSocket Notification
{
  "jsonrpc": "2.0",
  "method": "accountNotification",
  "params": {
    "result": {
      "context": {
        "slot": 5208469
      },
      "value": {
        "data": ["base64EncodedAccountData", "base64"],
        "executable": false,
        "lamports": 33594,
        "owner": "11111111111111111111111111111112",
        "rentEpoch": 636
      }
    },
    "subscription": 23784
  }
}
§Notes
  • The subscription remains active until explicitly unsubscribed or the connection is closed.
  • Account notifications are sent whenever any aspect of the account changes.
  • The encoding format specified in the config determines how account data is serialized.
  • Invalid public key formats will cause the subscription to be rejected with an error.
  • Each subscription runs in its own async task to ensure optimal performance.
§See Also
  • accountUnsubscribe: Remove an active account subscription
  • getAccountInfo: Get current account information
Source

fn account_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>

Unsubscribe from account change notifications.

This method removes an active account subscription, stopping further notifications for the specified subscription ID. The monitoring task will automatically terminate when the subscription is removed.

§Parameters
  • meta: Optional WebSocket metadata containing connection information.
  • subscription: The subscription ID to remove, as returned by accountSubscribe.
§Returns

A Result<bool> indicating whether the unsubscription was successful:

  • Ok(true) if the subscription was successfully removed
  • Err(Error) with InvalidParams if the subscription ID doesn’t exist
§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "accountUnsubscribe",
  "params": [23784]
}
§Example WebSocket Response
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}
§Notes
  • Attempting to unsubscribe from a non-existent subscription will return an error.
  • Successfully unsubscribed connections will no longer receive account notifications.
  • The monitoring task automatically detects subscription removal and terminates gracefully.
  • This method is thread-safe and can be called concurrently.
§See Also
  • accountSubscribe: Create an account change subscription
Source

fn slot_subscribe(&self, meta: Self::Metadata, subscriber: Subscriber<SlotInfo>)

Subscribe to slot notifications.

This method allows clients to subscribe to updates for a specific slot. The subscriber will receive notifications whenever the slot changes.

§Parameters
  • meta: WebSocket metadata containing RPC context and connection information.
  • subscriber: The subscription sink for sending slot update notifications to the client.
§Returns

This method does not return a value directly. Instead, it establishes a continuous WebSocket subscription that will send SlotInfo notifications to the subscriber whenever the slot changes.

§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "slotSubscribe",
  "params": [
    {
      "commitment": "finalized"
    }
  ]
}
§Example WebSocket Response (Subscription Confirmation)
{
  "jsonrpc": "2.0",
  "result": 5207624,
  "id": 1
}
§Example WebSocket Notification
{
  "jsonrpc": "2.0",
  "method": "slotNotification",
  "params": {
    "result": {
      "slot": 5207624
    },
    "subscription": 5207624
  }
}
§Notes
  • The subscription remains active until explicitly unsubscribed or the connection is closed.
  • Slot notifications are sent whenever the slot changes.
  • The subscription automatically terminates when the slot changes.
  • Each subscription runs in its own async task for optimal performance.
§See Also
  • slotUnsubscribe: Remove an active slot subscription
Source

fn slot_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>

Unsubscribe from slot notifications.

This method removes an active slot subscription, stopping further notifications for the specified subscription ID.

§Parameters
  • meta: Optional WebSocket metadata containing connection information.
  • subscription: The subscription ID to remove, as returned by slotSubscribe.
§Returns

A Result<bool> indicating whether the unsubscription was successful:

  • Ok(true) if the subscription was successfully removed
  • Err(Error) with InvalidParams if the subscription ID doesn’t exist
§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "slotUnsubscribe",
  "params": [0]
}
§Example WebSocket Response
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}
§Notes
  • Attempting to unsubscribe from a non-existent subscription will return an error.
  • Successfully unsubscribed connections will no longer receive notifications.
  • This method is thread-safe and can be called concurrently.
§See Also
  • slotSubscribe: Create a slot subscription
Source

fn logs_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<RpcLogsResponse>>, mentions: Option<RpcTransactionLogsFilter>, commitment: Option<CommitmentConfig>, )

Subscribe to logs notifications.

This method allows clients to subscribe to transaction log messages emitted during transaction execution. It supports filtering by signature, account mentions, or all transactions.

§Parameters
  • meta: WebSocket metadata containing RPC context and connection information.
  • subscriber: The subscription sink for sending log notifications to the client.
  • mentions: Optional filter for the subscription: can be a specific signature, account, or "all".
  • commitment: Optional commitment level for filtering logs by block finality.
§Returns

This method establishes a continuous WebSocket subscription that streams RpcLogsResponse notifications as new transactions are processed.

§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "logsSubscribe",
  "params": [
    {
      "mentions": ["11111111111111111111111111111111"]
    },
    {
      "commitment": "finalized"
    }
  ]
}
§Example WebSocket Response (Subscription Confirmation)
{
  "jsonrpc": "2.0",
  "result": 42,
  "id": 1
}
§Example WebSocket Notification
{
  "jsonrpc": "2.0",
  "method": "logsNotification",
  "params": {
    "result": {
      "signature": "3s6n...",
      "err": null,
      "logs": ["Program 111111... invoke [1]", "Program 111111... success"]
    },
    "subscription": 42
  }
}
§Notes
  • The subscription remains active until explicitly unsubscribed or the connection is closed.
  • Each log subscription runs independently and supports filtering.
  • Log messages may be truncated depending on cluster configuration.
§See Also
  • logsUnsubscribe: Remove an active logs subscription.
Source

fn logs_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>

Unsubscribe from logs notifications.

This method removes an active logs subscription, stopping further notifications for the specified subscription ID.

§Parameters
  • meta: Optional WebSocket metadata containing connection information.
  • subscription: The subscription ID to remove, as returned by logsSubscribe.
§Returns

A Result<bool> indicating whether the unsubscription was successful:

  • Ok(true) if the subscription was successfully removed.
  • Err(Error) with InvalidParams if the subscription ID is not recognized.
§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "logsUnsubscribe",
  "params": [42]
}
§Example WebSocket Response
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}
§Notes
  • Unsubscribing from a non-existent subscription ID returns an error.
  • Successfully unsubscribed clients will no longer receive logs notifications.
  • This method is thread-safe and may be called concurrently.
§See Also
  • logsSubscribe: Create a logs subscription.
Source

fn root_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<()>>, )

Source

fn root_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>

Source

fn program_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<RpcKeyedAccount>>, pubkey_str: String, config: Option<RpcProgramSubscribeConfig>, )

Subscribe to notifications for all accounts owned by a specific program via WebSocket.

This method allows clients to subscribe to updates for any account whose owner matches the given program ID. Notifications are sent whenever an account owned by the program is created, updated, or deleted.

§Parameters
  • meta: WebSocket metadata containing RPC context and connection information.
  • subscriber: The subscription sink for sending program account notifications to the client.
  • pubkey_str: The program public key to monitor, as a base-58 encoded string.
  • config: Optional configuration specifying commitment level, encoding format, and filters.
§Returns

This method does not return a value directly. Instead, it establishes a continuous WebSocket subscription that will send RpcResponse<RpcKeyedAccount> notifications to the subscriber whenever an account owned by the program changes.

§Filters

The optional config may include filters to narrow which account updates trigger notifications:

  • dataSize: Only notify for accounts with a specific data length (in bytes).
  • memcmp: Only notify for accounts whose data matches specific bytes at a given offset.
§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "programSubscribe",
  "params": [
    "11111111111111111111111111111111",
    {
      "encoding": "base64",
      "filters": [
        { "dataSize": 80 }
      ]
    }
  ]
}
§Example WebSocket Response (Subscription Confirmation)
{
  "jsonrpc": "2.0",
  "result": 24040,
  "id": 1
}
§Example WebSocket Notification
{
  "jsonrpc": "2.0",
  "method": "programNotification",
  "params": {
    "result": {
      "context": { "slot": 5208469 },
      "value": {
        "pubkey": "H4vnBqifaSACnKa7acsxstsY1iV1bvJNxsCY7enrd1hq",
        "account": {
          "data": ["base64data", "base64"],
          "executable": false,
          "lamports": 33594,
          "owner": "11111111111111111111111111111111",
          "rentEpoch": 636,
          "space": 36
        }
      }
    },
    "subscription": 24040
  }
}
§Notes
  • The subscription remains active until explicitly unsubscribed or the connection is closed.
  • Notifications include both the account pubkey and the full account data.
  • Invalid public key formats will cause the subscription to be rejected with an error.
  • Each subscription runs in its own async task for optimal performance.
§See Also
  • programUnsubscribe: Remove an active program subscription
  • getProgramAccounts: Get current accounts for a program
Source

fn program_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>

Unsubscribe from program account change notifications.

This method removes an active program subscription, stopping further notifications for the specified subscription ID. The monitoring task will automatically terminate when the subscription is removed.

§Parameters
  • meta: Optional WebSocket metadata containing connection information.
  • subscription: The subscription ID to remove, as returned by programSubscribe.
§Returns

A Result<bool> indicating whether the unsubscription was successful:

  • Ok(true) if the subscription was successfully removed
  • Err(Error) with InternalError if the subscription map lock could not be acquired
§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "programUnsubscribe",
  "params": [24040]
}
§Example WebSocket Response
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}
§Notes
  • Successfully unsubscribed connections will no longer receive program account notifications.
  • The monitoring task automatically detects subscription removal and terminates gracefully.
  • This method is thread-safe and can be called concurrently.
§See Also
  • programSubscribe: Create a program account change subscription
Source

fn slots_updates_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<Arc<SlotUpdate>>, )

Subscribe to tagged slot lifecycle notifications via WebSocket.

This method streams SlotUpdate notifications produced by the underlying surfnet SVM whenever a slot advances through its lifecycle. The notification payload follows Solana’s reference slotsUpdatesSubscribe wire format: a tagged enum serialized with type discriminator and camelCase variants (e.g. "createdBank", "frozen", "optimisticConfirmation", "root").

§Parameters
  • meta: WebSocket metadata containing RPC context and connection information.
  • subscriber: The subscription sink for sending slot update notifications to the client.
§Returns

This method does not return a value directly. Instead, it establishes a continuous WebSocket subscription that streams SlotUpdate notifications to the subscriber whenever the slot advances through its lifecycle.

§Variants Emitted by Surfpool
  • createdBank – emitted when the simulator opens a new slot.
  • frozen – emitted once the previous slot has been confirmed, carrying execution stats.
  • optimisticConfirmation – emitted alongside Geyser’s Confirmed slot-status update for the freshly confirmed slot.
  • root – emitted alongside Geyser’s Rooted slot-status update.

Surfpool has no gossip/shred layer, so the firstShredReceived, completed, and dead variants documented in the Solana reference are not produced by this implementation.

§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "slotsUpdatesSubscribe"
}
§Example WebSocket Response (Subscription Confirmation)
{
  "jsonrpc": "2.0",
  "result": 0,
  "id": 1
}
§Example WebSocket Notification (frozen variant)
{
  "jsonrpc": "2.0",
  "method": "slotsUpdatesNotification",
  "params": {
    "result": {
      "type": "frozen",
      "slot": 356,
      "timestamp": 1774643712834,
      "stats": {
        "numTransactionEntries": 1,
        "numSuccessfulTransactions": 1,
        "numFailedTransactions": 0,
        "maxTransactionsPerEntry": 1
      }
    },
    "subscription": 4
  }
}
§Notes
  • The subscription remains active until explicitly unsubscribed or the connection is closed.
  • Notifications are delivered without an RpcResponse wrapper – the tagged SlotUpdate value appears directly under params.result.
  • The timestamp field is a wall-clock millisecond Unix timestamp.
  • Each subscription runs in its own async task for optimal performance.
§See Also
  • [slotsUpdatesUnsubscribe]: Remove an active subscription
  • [slotSubscribe]: Subscribe to the simpler SlotInfo stream
Source

fn slots_updates_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>

Unsubscribe from tagged slot lifecycle notifications.

This method removes an active slotsUpdatesSubscribe subscription, stopping further notifications for the specified subscription ID. The background monitoring task will detect the removal and terminate gracefully.

§Parameters
  • meta: Optional WebSocket metadata containing connection information.
  • subscription: The subscription ID to remove, as returned by slotsUpdatesSubscribe.
§Returns

A Result<bool> indicating whether the unsubscription was successful:

  • Ok(true) if the subscription was successfully removed
  • Err(Error) with InternalError if the subscription map lock could not be acquired
§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "slotsUpdatesUnsubscribe",
  "params": [0]
}
§Example WebSocket Response
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}
§See Also
  • slotsUpdatesSubscribe: Create a slots-updates subscription.
Source

fn block_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<()>>, )

Source

fn block_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>

Source

fn vote_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<RpcResponse<()>>, )

Source

fn vote_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>

Source

fn snapshot_subscribe( &self, meta: Self::Metadata, subscriber: Subscriber<SnapshotImportNotification>, snapshot_url: String, )

Subscribe to snapshot import notifications via WebSocket.

This method allows clients to subscribe to real-time updates about snapshot import operations from a specific snapshot URL. The subscriber will receive notifications when the snapshot is being imported, including progress updates and completion status.

§Parameters
  • meta: WebSocket metadata containing RPC context and connection information.
  • subscriber: The subscription sink for sending snapshot import notifications to the client.
  • snapshot_url: The URL of the snapshot to import and monitor.
§Returns

This method does not return a value directly. Instead, it establishes a continuous WebSocket subscription that will send SnapshotImportNotification notifications to the subscriber whenever the snapshot import operation status changes.

§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "snapshotSubscribe",
  "params": ["https://example.com/snapshot.json"]
}
§Example WebSocket Response (Subscription Confirmation)
{
  "jsonrpc": "2.0",
  "result": 12345,
  "id": 1
}
§Example WebSocket Notification
{
  "jsonrpc": "2.0",
  "method": "snapshotNotification",
  "params": {
    "result": {
      "snapshotId": "snapshot_20240107_123456",
      "status": "InProgress",
      "accountsLoaded": 1500,
      "totalAccounts": 3000,
      "error": null
    },
    "subscription": 12345
  }
}
§Notes
  • The subscription remains active until explicitly unsubscribed or the connection is closed.
  • Multiple clients can subscribe to different snapshot notifications simultaneously.
  • The snapshot URL must be accessible and contain a valid snapshot format.
  • Each subscription runs in its own async task for optimal performance.
§See Also
  • snapshotUnsubscribe: Remove an active snapshot subscription
Source

fn snapshot_unsubscribe( &self, meta: Option<Self::Metadata>, subscription: SubscriptionId, ) -> Result<bool>

Unsubscribe from snapshot import notifications.

This method removes an active snapshot subscription, stopping further notifications for the specified subscription ID.

§Parameters
  • meta: Optional WebSocket metadata containing connection information.
  • subscription: The subscription ID to remove, as returned by snapshotSubscribe.
§Returns

A Result<bool> indicating whether the unsubscription was successful:

  • Ok(true) if the subscription was successfully removed
  • Err(Error) with InvalidParams if the subscription ID doesn’t exist
§Example WebSocket Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "snapshotUnsubscribe",
  "params": [12345]
}
§Example WebSocket Response
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}
§Notes
  • Attempting to unsubscribe from a non-existent subscription will return an error.
  • Successfully unsubscribed connections will no longer receive snapshot notifications.
  • This method is thread-safe and can be called concurrently.
§See Also
  • snapshotSubscribe: Create a snapshot import subscription

Provided Methods§

Source

fn to_delegate(self) -> IoDelegate<Self, Self::Metadata>

Create an IoDelegate, wiring rpc calls to the trait methods.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§