eth_unsubscribe - Celo
Example code for the eth_unsubscribe JSON-RPC method. Complete guide on how to use eth_unsubscribe JSON-RPC in GetBlock Web3 documentation.
Parameters
Parameter
Type
Required
Description
Request Example
const WebSocket = require('ws');
const ws = new WebSocket('wss://go.getblock.io/<ACCESS-TOKEN>/');
ws.on('open', () => {
ws.send(JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'eth_unsubscribe',
params: ['0x9cef478923ff08bf67fde6c64013158d']
}));
});
ws.on('message', (data) => {
console.log(JSON.parse(data));
});import asyncio
import websockets
import json
async def unsubscribe():
uri = "wss://go.getblock.io/<ACCESS-TOKEN>/"
async with websockets.connect(uri) as ws:
await ws.send(json.dumps({
"jsonrpc": "2.0",
"id": 1,
"method": "eth_unsubscribe",
"params": ["0x9cef478923ff08bf67fde6c64013158d"]
}))
response = await ws.recv()
print(json.loads(response))
asyncio.run(unsubscribe())Response Example
Response Definition
Field
Type
Description
Use Cases
Error Handling
Error Code
Description
Last updated
Was this helpful?