logsUnsubscribe
Last updated:
logsUnsubscribe stops one log stream that was opened with
logsSubscribe on the same WebSocket connection. It
takes the integer subscription id from the subscribe ack, returns
result: true, and the server stops pushing logsNotification frames for
that id. Everything else on the connection — other log filters, account
watches, slot ticks — keeps flowing.
Log streams are among the chattiest subscriptions on Solana, especially with
the "all" filter or a mentions filter on a busy program, so releasing them
promptly matters more here than for most families. Typical moments to call it:
an indexer finished its catch-up phase and is switching from the firehose
"all" filter to targeted mentions filters; a monitoring dashboard closed
the panel that was tailing a program's activity; or you are rotating the set
of tracked addresses — since a mentions filter accepts exactly one pubkey
and cannot be edited in place, changing what you watch always means
subscribing to the new address first, then unsubscribing the old id.
The usual Pub/Sub lifecycle rules apply. Subscription ids are scoped to the
current WebSocket session: after a disconnect the server has already discarded
every subscription, so replaying stored ids into logsUnsubscribe on a fresh
socket fails with -32602 — just resubscribe and track the new ids. A second
unsubscribe of the same id fails the same way, because the first call removed
it. And notifications already in flight when you send the unsubscribe may
still be delivered for a moment; drop frames whose params.subscription you
no longer recognise instead of treating them as protocol errors. Closing the
socket outright releases all subscriptions at once, so shutdown paths need no
explicit unsubscribes.
Parameters
This method takes no parameters.
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://triport.io/sol \
-X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{"id":1,"method":"logsUnsubscribe","params":[],"jsonrpc":"2.0"}'const res = await fetch("https://triport.io/sol", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
body: JSON.stringify({
"id": 1,
"method": "logsUnsubscribe",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post(
"https://triport.io/sol",
headers={"Authorization": "Bearer <api-key>"},
json={"id":1,"method":"logsUnsubscribe","params":[],"jsonrpc":"2.0"},
)
print(resp.json())Usage
- Transport: WebSocket.
- Networks: mainnet, devnet, testnet.
- Credit cost: 1 per call.
FAQ
- What does logsUnsubscribe do?
- Cancels an active logsSubscribe stream, identified by the subscription id returned in the subscribe ack.
- How many credits does logsUnsubscribe cost?
- logsUnsubscribe costs 1 credit(s) per call on Triport by default.
- Is logsUnsubscribe available over WebSocket?
- Yes, logsUnsubscribe supports WebSocket.