> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# eth_unsubscribe | Ethereum

> Cancel any active Ethereum WebSocket subscription with eth_unsubscribe. Pass the subscription ID to stop receiving real-time event notifications.

When a client subscribes to a particular event, the Ethereum node will send updates as soon as they occur. However, in some cases, the client may no longer be interested in receiving updates for a particular event. The `eth_unsubscribe` method can be used to cancel the following subscriptions:

<CardGroup cols={2}>
  <Card title="eth_subscribe('newHeads')" icon="angle-right" iconType="solid" href="/reference/ethereum-native-subscribe-newheads" horizontal />

  <Card title="eth_subscribe('newPendingTransactions')" icon="angle-right" iconType="solid" href="/reference/ethereum-native-subscribe-newpendingtransactions" horizontal />

  <Card title="eth_subscribe('logs')" icon="angle-right" iconType="solid" href="/reference/ethereum-native-subscribe-logs" horizontal />
</CardGroup>

<Check>
  ### Get your own node endpoint today

  [Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required.

  You can sign up with your GitHub, X, Google, or Microsoft account.
</Check>

## Parameters

* `string` — the ID of the subscription that you want to cancel

## Response

* `boolean` — the boolean value indicating if the subscriptions were removed successfully. `true` if removed successfully, `false` if not.

## `eth_unsubscribe` code examples

<Info>
  Note that subscriptions require a WebSocket connection and [WebSocket cat](https://www.npmjs.com/package/wscat) for you to use this method in the console.

  Install WebSocket cat with:

  `npm install -g wscat`
</Info>

<CodeGroup>
  ```shell wscat theme={"system"}
  $ wscat -c YOUR_CHAINSTACK_WEBSOCKET_ENDPOINT
  # Wait for the connection to be established

  Connected (press CTRL+C to quit)

  > {"jsonrpc":"2.0","id": 1, "method": "eth_unsubscribe", "params": ["0x7529626735859f32962b10b19ee2e3eb"]}
  ```

  ```javascript javascript theme={"system"}
  const WebSocket = require('ws');

  const webSocket = new WebSocket('CHAINSTACK_WSS_URL');

  async function removeSubscription() {

    const request = {
      id: 1,
      jsonrpc: '2.0',
      method: 'eth_unsubscribe',
      params: ['0x9de3135dd3dd6c6b99bd104061a5af4f'],
    };

    const onOpen = (event) => {
      webSocket.send(JSON.stringify(request));
    };

    const onMessage = (event) => {
      const response = JSON.parse(event.data);
      console.log(response);
    };

    try {
      webSocket.addEventListener('open', onOpen);
      webSocket.addEventListener('message', onMessage);
    } catch (error) {
      console.error(error);
    }
  }

  removeSubscription();
  ```
</CodeGroup>

This will remove the subscription matching the ID passed as a parameter.
