programUnsubscribe
Unsubscribe from program-owned account change notifications. This method cancels an existing program subscription identified by the subscription ID that was returned from a previous programSubscribe call. Once unsubscribed, you will no longer receive programNotification messages for accounts owned by the specified program.
Authorizations
Body
Request object for unsubscribing from program account change notifications
jsonrpcstring · enumRequiredExample:
JSON-RPC protocol version
2.0
Possible values: idone ofRequiredExample:
Request identifier that will be returned in the response
1
stringOptional
numberOptional
methodstring · enumRequiredExample:
The WebSocket method name
programUnsubscribe
Possible values: paramsinteger[] · min: 1 · max: 1RequiredExample:
Method parameters array containing the program subscription ID to cancel
[24040]
Responses
200
Unsubscription successful
application/json
400
Bad Request - Invalid parameters
application/json
401
Unauthorized
text/plain
403
Forbidden
text/plain
429
Too Many Requests
text/plain
500
Internal Server Error
text/plain
post
const ws = new WebSocket('wss://public.rpc.solanavibestation.com');
let subscriptionId = 24040; // From previous programSubscribe call
ws.onopen = function() {
// Unsubscribe from program account change notifications
ws.send(JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'programUnsubscribe',
params: [subscriptionId]
}));
};
ws.onmessage = function(event) {
const data = JSON.parse(event.data);
if (data.result === true) {
console.log('Successfully unsubscribed from program subscription:', subscriptionId);
} else if (data.error) {
console.error('Unsubscribe failed:', data.error);
}
};
{
"jsonrpc": "2.0",
"result": true,
"id": 1
}
Last updated