state_unsubscribeStorage - Bittensor RPC Method
Cancel a storage subscription on Bittensor via WebSocket.
Cancels a WebSocket subscription that was started with state_subscribeStorage. After calling this method, no further storage change notifications will be delivered for that subscription. Provide the subscription ID that was returned when the subscription was created.
Code Examples
This method requires a WebSocket connection and is not available over HTTP.
WebSocket (wscat)
wscat -c wss://api-bittensor-mainnet.n.dwellir.com/YOUR_API_KEY \
-x '{
"jsonrpc": "2.0",
"method": "state_unsubscribeStorage",
"params": ["SUBSCRIPTION_ID"],
"id": 1
}'Use Cases
- Subscription cleanup -- Cancel storage change notifications when your application no longer needs real-time updates for those keys.
- Resource management -- Free server-side memory and bandwidth by removing unused subscriptions.
- Key set changes -- Unsubscribe from the current key set and create a new subscription with a different set of keys to watch.
Notes
- Always unsubscribe when done to prevent server-side resource leaks, especially in long-running applications.
- If the WebSocket connection drops, subscriptions are automatically cleaned up, but explicit unsubscription is still best practice.
- WebSocket-only; cannot be called over HTTP.
Related Methods
state_subscribeStorage-- Start the subscription this method cancelsstate_unsubscribeRuntimeVersion-- Cancel a runtime version subscriptionstate_queryStorageAt-- One-shot storage query as an alternative to subscriptions