signatureUnsubscribe
Unsubscribe from signature confirmation notification. This method cancels an existing signature subscription identified by the subscription ID that was returned from a previous signatureSubscribe call. Note that signature subscriptions are automatically cancelled by the server after sending the first notification, so this method is typically used to cancel a subscription before the transaction is confirmed or processed.
Request object for unsubscribing from signature confirmation notifications
JSON-RPC protocol version
2.0
Possible values: Request identifier that will be returned in the response
1
The WebSocket method name
signatureUnsubscribe
Possible values: Method parameters array containing the signature subscription ID to cancel
[24006]
Unsubscription successful
Bad Request - Invalid parameters
Unauthorized
Forbidden
Too Many Requests
Internal Server Error
const ws = new WebSocket('wss://public.rpc.solanavibestation.com');
let subscriptionId = 24006; // From previous signatureSubscribe call
ws.onopen = function() {
// Unsubscribe from signature confirmation notifications
ws.send(JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'signatureUnsubscribe',
params: [subscriptionId]
}));
};
ws.onmessage = function(event) {
const data = JSON.parse(event.data);
if (data.result === true) {
console.log('Successfully unsubscribed from signature notifications:', subscriptionId);
console.log('No longer waiting for transaction confirmation');
} else if (data.error) {
console.error('Unsubscribe failed:', data.error);
if (data.error.message === 'Subscription not found') {
console.log('Subscription may have been auto-cancelled already');
}
}
};
{
"jsonrpc": "2.0",
"result": true,
"id": 1
}
Last updated