> For the complete documentation index, see [llms.txt](https://docs.infoway.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.infoway.io/en-docs/websocket/websocket-unsubscribe-method/real-time-news-news-unsubscribe.md).

# Real-Time News (News) Unsubscribe

#### Overview

This document describes how to cancel the news subscription on the current WebSocket connection without disconnecting. After unsubscribing, news will no longer be pushed until a new subscription is made.

Each news connection keeps only one subscription at a time. Unsubscribing clears the **entire** current subscription criteria.

#### Request Frequency

Keep the connection alive with heartbeats. It is recommended to send a heartbeat every **30 seconds** (protocol number `10010`). If the server does not receive a heartbeat (business heartbeat or WebSocket Ping) for more than **60 seconds**, the connection will be closed automatically.

#### Error Code Explanation

Please refer to the WebSocket error code documentation for further details.

#### Subscription Address

```
wss://data.infoway.io/news?apikey=YourAPIKey
```

#### Request (Protocol Number: 11020)

```json
{
    "code": 11020,
    "trace": "423afec425004bd8a5e02e1ba5f9b2b0"
}
```

| Parameter | Type    | Required | Description                     | Example                             |
| --------- | ------- | -------- | ------------------------------- | ----------------------------------- |
| `code`    | Integer | Yes      | Protocol number for the request | Real-time news unsubscribe: `11020` |
| `trace`   | String  | Yes      | Trace ID (random string)        | `423afec425004bd8a5e02e1ba5f9b2b0`  |

#### Response (Protocol Number: 11010)

```json
{
    "code": 11010,
    "trace": "423afec425004bd8a5e02e1ba5f9b2b0",
    "msg": "ok"
}
```

| Parameter | Type    | Required | Description               | Example                            |
| --------- | ------- | -------- | ------------------------- | ---------------------------------- |
| `code`    | Integer | Yes      | Response protocol number  | Unsubscribe response: `11010`      |
| `trace`   | String  | Yes      | Trace ID from the request | `423afec425004bd8a5e02e1ba5f9b2b0` |
| `msg`     | String  | Yes      | Response message          | `ok`                               |
