Remove subscriptions at various levels of granularity.
The unsubscribe operation supports multiple levels of granularity -- from removing a single topic to clearing everything at once.
Unsubscribe from Everything
Omit all optional fields to remove every subscription.
{ "op": "unsubscribe" }Response
{
"op": "unsubscribed",
"removed": 5,
"topics_now": 0
}Unsubscribe a Single Topic
Provide network, address, and stream to remove one specific subscription.
{
"op": "unsubscribe",
"network": "sol",
"address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"stream": "clusters"
}Response
{
"op": "unsubscribed",
"removed": 1,
"topics_now": 4
}Unsubscribe Multiple Addresses
Provide network, stream, and an addresses array to remove several addresses from the same stream in one call.
{
"op": "unsubscribe",
"network": "sol",
"stream": "clusters",
"addresses": [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"So11111111111111111111111111111111111111112"
]
}Unsubscribe by Network + Stream
Remove all subscriptions for a specific network and stream combination.
{
"op": "unsubscribe",
"network": "sol",
"stream": "clusters"
}This removes every Solana clusters subscription but leaves other network/stream combinations intact.
Unsubscribe by Stream Only
Remove all subscriptions for a given stream across all networks.
{
"op": "unsubscribe",
"stream": "clusters"
}This removes all clusters subscriptions regardless of network.
Unsubscribe by Network + Address
Remove all streams for a specific address on a network.
{
"op": "unsubscribe",
"network": "sol",
"address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
}Unsubscribe Multiple Addresses (All Streams)
Remove all streams for multiple addresses on a network.
{
"op": "unsubscribe",
"network": "sol",
"addresses": [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"So11111111111111111111111111111111111111112"
]
}Response Shape
All unsubscribe responses share the same format:
{
"op": "unsubscribed",
"removed": 3,
"topics_now": 2
}| Field | Type | Description |
|---|---|---|
removed | integer | Number of subscriptions that were actually removed |
topics_now | integer | Total active individual topic count after the operation |
If the subscription you're trying to remove doesn't exist,
removedwill be0-- this is not an error.
Quick Reference
| Fields provided | Behaviour |
|---|---|
| (none) | Unsubscribe everything |
stream | All subscriptions on that stream, all networks |
network + stream | All addresses on that network+stream |
network + address + stream | Single topic |
network + stream + addresses[] | Multiple specific addresses |
network + address (no stream) | All streams for that address |
network + addresses[] (no stream) | All streams for those addresses |