# Subscribing & Unsubscribing

### Subscribing

Subscribing to checkpoints enables you to listen to current state events for accounts, transactions (such as payments) and token activity.&#x20;

To subscribe to a stream with the name `stream` send a text frame over the websocket connection with the following JSON payload:

```
{
  "id": 1,
  "method": "SUBSCRIBE",
  "stream": 
      {
          "name": "CHECKPOINTS",
          "full": true
      }
}
```

confirmation will be received as below:

```
{
  "id": 1,
  "result": "11223344556677889900"
}
```

{% hint style="success" %}
Have a try with below command in your terminal:

```json
{"id": 1,"method": "SUBSCRIBE","stream": {"name": "CHECKPOINTS","full": true}}
```

or with below:

<pre class="language-json"><code class="lang-json"><strong>{"id": 1,"method": "SUBSCRIBE","stream": {"name": "CHECKPOINTS","full": false}}
</strong></code></pre>

{% endhint %}

### Unsubscribing

Similarly, to unsubscribe from a stream with the name `stream`:

```
{
  "id", 1,
  "method": "UNSUBSCRIBE",
  "stream": "CHECKPOINTS"
}
```

confirmation will be received as below:

```
{
  "id": 1,
  "result": true
}
```

{% hint style="success" %}
When subscribed, try with below command in your terminal:

```json
{"id": 1,"method": "UNSUBSCRIBE","stream": "CHECKPOINTS"}
```

{% endhint %}
