eth_unsubscribe
Network: Optimism Sepolia · Testnet · Chain ID 11155420 (0xaa37dc)
Counts as 1 request. See Request Counting.
Protocol: WebSocket (WSS) only
Description
Unsubscribe from a previously created subscription.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
subscriptionId | hex | Yes | Subscription ID |
Request
{
"jsonrpc": "2.0",
"method": "eth_unsubscribe",
"params": ["0x1"],
"id": 1
}Code Examples
const ws = new WebSocket("wss://optimism-sepolia-rpc.blockreq.com/v1/rpc/public");
ws.onopen = () => {
ws.send(JSON.stringify({
"jsonrpc": "2.0",
"method": "eth_unsubscribe",
"params": [
"0x1"
],
"id": 1
}));
};
ws.onmessage = (event) => {
console.log(JSON.parse(event.data));
};