programUnsubscribe – Solana
The programUnsubscribe JSON-RPC method allows clients to unsubscribe from notifications regarding accounts owned by a specified program.
Last updated
Was this helpful?
Was this helpful?
wscat -c "wss://go.getblock.io/<ACCESS-TOKEN>/" --exec '{
"jsonrpc": "2.0",
"id": 1,
"method": "programUnsubscribe",
"params": [0]
}'{
"jsonrpc": "2.0",
"result": true,
"id": 1
}{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Invalid subscription ID"
},
"id": 1
}const WebSocket = require('ws');
const url = "wss://go.getblock.io/<ACCESS-TOKEN>/";
const payload = {
jsonrpc: "2.0",
id: 1,
method: "programUnsubscribe",
params: [0]
};
const ws = new WebSocket(url);
ws.on('open', () => {
ws.send(JSON.stringify(payload));
});
ws.on('message', (data) => {
console.log("Unsubscribe Response:", JSON.parse(data));
});
ws.on('error', (error) => {
console.error("WebSocket error:", error.message);
});
ws.on('close', () => {
console.log("WebSocket connection closed");
});