TriportRPC

rootUnsubscribe

Last updated:

rootUnsubscribe stops a finality stream opened with rootSubscribe on the same WebSocket connection. Its only parameter is the integer subscription id from the subscribe ack; on success the server replies result: true and no further rootNotification frames are delivered for that id. The connection stays up and any other subscriptions on it are untouched.

Root streams are steady rather than bursty — the root advances nearly every slot — so the reasons to unsubscribe are about scope, not volume. The classic pattern is a bounded finality wait: a payment backend subscribes, waits until the root passes the slot that contains a deposit, credits the account, and then has no further use for the stream — unsubscribing there keeps long-lived connections from accumulating forgotten watchers. Other cases: a reorg-safe indexer switches from live tailing to batch mode during a backfill, or a monitoring panel showing finality lag is closed while the rest of the app's subscriptions stay active on the shared socket.

The lifecycle semantics are the standard Pub/Sub contract. Subscription ids belong to the session that issued them: after a disconnect every subscription is already gone server-side, so replaying a stored id on a new socket fails with -32602 (invalid subscription id) — resubscribe instead, and re-baseline with a finalized-commitment getSlot call to cover the gap. Unsubscribing the same id twice fails the same way. A final notification can cross paths with the unsubscribe request, so treat frames for unknown ids as noise to drop, not errors to raise. And when tearing down the whole connection, skip the per-id ceremony — closing the socket releases every subscription attached to it in one step.

Parameters

This method takes no parameters.

Returns

rootUnsubscribe return value
FieldType
resultobject

Examples

curl https://triport.io/sol \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"id":1,"method":"rootUnsubscribe","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": "rootUnsubscribe",
  "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":"rootUnsubscribe","params":[],"jsonrpc":"2.0"},
)
print(resp.json())

Usage

  1. Transport: WebSocket.
  2. Networks: mainnet, devnet, testnet.
  3. Credit cost: 1 per call.

FAQ

What does rootUnsubscribe do?
Cancels an active rootSubscribe stream, identified by the subscription id returned in the subscribe ack.
How many credits does rootUnsubscribe cost?
rootUnsubscribe costs 1 credit(s) per call on Triport by default.
Is rootUnsubscribe available over WebSocket?
Yes, rootUnsubscribe supports WebSocket.