Skip to main content

slotUnsubscribe

Unsubscribe from slot notifications

Common use cases
Subscription cleanup on shutdownFree server resources when application or monitoring component stops. Always call slotUnsubscribe in cleanup handlers to prevent resource leaks and ensure proper WebSocket lifecycle management.
Dynamic subscription managementStop slot monitoring when switching between different data sources or RPC providers. Unsubscribe from current provider before subscribing to new one to avoid duplicate notifications and resource contention.

Parameters

subscriptionId (integer, required)

subscription id to cancel

Request

wscat -c wss://solana-mainnet.api.syndica.io -x '{
"jsonrpc": "2.0",
"id": 1,
"method": "slotUnsubscribe",
"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 slotUnsubscribe?

The subscription remains active on the server until the WebSocket connection closes, consuming resources. Always explicitly unsubscribe for proper resource management.

Can I reuse a subscription ID after unsubscribing?

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

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

slotSubscribe
Creates slot subscription. Always paired with slotUnsubscribe; every slotSubscribe should have a corresponding slotUnsubscribe call for proper resource management.

slotsUpdatesUnsubscribe
Cancels slotsUpdates subscription. Similar unsubscribe pattern; both follow standard WebSocket subscription lifecycle where unsubscribe methods take subscription ID and return boolean success status.

External Resources