Skip to main content

slotsUpdatesUnsubscribe

Unsubscribe from slot-update notifications

Common use cases
Cleanup on application shutdownUnsubscribe from slot updates when application or monitoring component stops to free server resources. Always call slotsUpdatesUnsubscribe in cleanup handlers (e.g., process exit, component unmount) to prevent resource leaks and ensure proper WebSocket lifecycle management.
Dynamic subscription lifecycle managementStop slot lifecycle monitoring when switching between validators, changing monitoring strategies, or reconfiguring subscription parameters. Unsubscribe from current slotsUpdates feed before creating new subscription to avoid duplicate notifications and resource contention.

Parameters

subscriptionId (number, required)

subscription id to cancel

Request

wscat -c wss://solana-mainnet.api.syndica.io -x '{
"jsonrpc": "2.0",
"id": 1,
"method": "slotsUpdatesUnsubscribe",
"params": [
0
]
}'
Network Selection

Replace mainnet with devnet in the URL to query devnet instead.

Response

{
"jsonrpc": "2.0",
"result": true,
"id": 1
}

Response Fields

Return value: boolean

unsubscribe success message

FAQ and Troubleshooting

What happens if I don't call slotsUpdatesUnsubscribe?

The subscription remains active on the server until the WebSocket connection closes, consuming resources. Always explicitly unsubscribe for proper resource management, especially in long-running applications.

Can I reuse a subscription ID after unsubscribing?

No. Each subscription ID is unique per WebSocket connection. Create a new subscription with slotsUpdatesSubscribe if you need to resume monitoring slot lifecycle events.

What does the boolean result mean?

The result is 'true' if the subscription was successfully cancelled, or 'false' if the subscription ID wasn't found (already unsubscribed or never existed). Check the return value to verify cleanup success.

Does unsubscribe close the WebSocket connection?

No. slotsUpdatesUnsubscribe only cancels the specific subscription. The WebSocket connection remains open for other subscriptions or RPC calls. Close the connection separately if needed.

slotsUpdatesSubscribe
Creates slotsUpdates subscription. Always paired with slotsUpdatesUnsubscribe; every slotsUpdatesSubscribe should have a corresponding unsubscribe call for proper resource management.

slotUnsubscribe
Cancels basic slot subscription. Similar unsubscribe pattern for different subscription type; both follow standard WebSocket lifecycle where unsubscribe methods take subscription ID and return boolean success status.

External Resources