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

# Heartbeat

> This page describes the heartbeat mechanism of AllTick’s stock WebSocket API, showing Ping-Pong message formats and how to keep connections alive, detect disconnects, and reconnect, so developers can maintain stable WebSocket streams for realtime tick and order book data.

## Interface Description

The requester is required to send a heartbeat every 10 seconds. If no heartbeat request is received within 30 seconds, it will be considered timed out and the requester’s WebSocket connection will be disconnected.

## Request - Protocol Number: 22000

### Data Structure (JSON)

```json theme={null}
{
  "cmd_id": 22000,
  "seq_id": 123,
  "trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
  "data": {}
}
```

## Response - Protocol Number: 22001

### Data Structure (JSON)

```json theme={null}
{
  "ret": 200,
  "msg": "ok",
  "cmd_id": 22001,
  "seq_id": 123,
  "trace": "3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
  "data": {}
}
```

#### AllTick Website

<Note>
  Official website: <a href="https://alltick.co/">[https://alltick.co/](https://alltick.co/)</a>
</Note>

<script src="/seo-keywords.js" />
