signatureUnsubscribe
Last updated:
signatureUnsubscribe cancels a signature watch opened with
signatureSubscribe on the same WebSocket
connection. Pass the integer subscription id from the subscribe ack; the
server answers result: true and the pending wait is abandoned. The
connection and any other subscriptions on it are unaffected.
Unlike the other Pub/Sub families, you rarely call this method on the happy
path. A signature subscription is one-shot: once the transaction reaches the
requested commitment and the signatureNotification is delivered, the server
cancels the subscription by itself. signatureUnsubscribe exists for the
unhappy paths — the cases where the notification is never going to come or
you have stopped caring. Typical scenarios: the transaction's blockhash
expired and you are about to rebuild and re-send it (the old signature will
never confirm, so the watch would dangle forever), a user cancelled the
checkout flow that was waiting on payment confirmation, or your own timeout
fired and you are switching to a polling fallback.
Because of the auto-cancel behaviour, a race is built into this method: if
the confirmation lands while your unsubscribe frame is in flight, the
subscription id is already gone by the time the server processes your request,
and the call fails with an invalid-subscription error (-32602). Treat that
error as benign — it simply means the notification beat you to it, and you
should check whether a signatureNotification for that id arrived just before.
Ids are also session-local: after a reconnect the old id is dead, and the
right recovery is a fresh getSignatureStatuses poll plus, if still pending,
a new subscribe — not an unsubscribe.
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":"signatureUnsubscribe","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": "signatureUnsubscribe",
"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":"signatureUnsubscribe","params":[],"jsonrpc":"2.0"},
)
print(resp.json())Usage
- Transport: WebSocket.
- Networks: mainnet, devnet, testnet.
- Credit cost: 1 per call.
FAQ
- What does signatureUnsubscribe do?
- Cancels a pending signatureSubscribe wait before its notification has fired, using the subscription id from the subscribe ack.
- How many credits does signatureUnsubscribe cost?
- signatureUnsubscribe costs 1 credit(s) per call on Triport by default.
- Is signatureUnsubscribe available over WebSocket?
- Yes, signatureUnsubscribe supports WebSocket.