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

# Subscription

> Subscribe and unsubscribe from news events

## Subscribe to News

Start receiving real-time news updates by subscribing to specific criteria.

```javascript theme={null}
socket.emit('news:subscribe', {
  minImportance: 7,
  symbol: 'AAPL',
  limit: 20,
  startDate: '2024-01-01T00:00:00.000Z',
  endDate: '2024-01-31T23:59:59.999Z'
});
```

**Parameters:**

| Parameter       | Type    | Description                           | Default |
| --------------- | ------- | ------------------------------------- | ------- |
| `minImportance` | integer | Minimum importance level (0-10)       | 0       |
| `symbol`        | string  | Stock symbol filter                   | -       |
| `limit`         | integer | Max articles per batch (1-100)        | 10      |
| `startDate`     | string  | Start of date range filter (ISO 8601) | -       |
| `endDate`       | string  | End of date range filter (ISO 8601)   | -       |

## Subscription Confirmation

Receive confirmation when subscription is successful.

```javascript theme={null}
socket.on('news:subscribed', (confirmation) => {
  console.log('Subscription confirmed:', confirmation);
});
```

**Response (official format):**

```json theme={null}
{
  "type": "news",
  "params": {
    "limit": 20,
    "minImportance": 7,
    "symbol": "AAPL"
  },
  "message": "Successfully subscribed to news feed - 실시간 업데이트 활성화됨"
}
```

## Unsubscribe

Remove specific subscriptions or unsubscribe from all topics.

```javascript theme={null}
// Unsubscribe from specific symbol
socket.emit('news:unsubscribe', {
  symbol: 'AAPL'
});

// Unsubscribe from all news
socket.emit('news:unsubscribe:all');
```

## Multiple Subscriptions

Subscribe to multiple criteria simultaneously.

```javascript theme={null}
// Subscribe to high-importance general news
socket.emit('news:subscribe', {
  minImportance: 9
});

// Subscribe to AAPL news
socket.emit('news:subscribe', {
  symbol: 'AAPL',
  minImportance: 6
});
```
