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

# 心跳检测（Ping）

## 套餐权限

| 套餐 | 可用 |
| - | :-: |
| 免费版 | ✅ |
| 基础版 | ✅ |
| 专业版 | ✅ |
| 全量套餐（A 股、港股、美股） | ✅ |
| 企业版 | ✅ |

用于检查连接是否保持可用。发送 `ping` 后，服务端返回 `pong`，其中 `data.timestamp` 为毫秒级 Unix 时间戳。

## 发送消息

```json theme={null}
{"cmd":"ping"}
```

## 返回消息

```json theme={null}
{"cmd":"pong","code":0,"message":"pong","data":{"timestamp":1768976158541}}
```


## AsyncAPI

````yaml asyncapi.json ping
id: ping
title: Ping
description: ''
servers:
  - id: production
    protocol: wss
    host: api.tickdb.ai
    bindings: []
    variables: []
address: /v1/realtime
parameters: []
bindings: []
operations:
  - &ref_2
    id: sendPing
    title: Send ping
    type: send
    messages:
      - &ref_4
        id: pongResponse
        contentType: application/json
        payload:
          - name: Pong 响应
            description: 服务端对 ping 的响应。
            type: object
            properties:
              - name: cmd
                type: string
                description: Pong 响应。
                required: true
              - name: code
                type: integer
                description: 响应码。
                required: true
              - name: message
                type: string
                description: 响应消息。
                required: true
              - name: data
                type: object
                required: true
                properties:
                  - name: timestamp
                    type: integer
                    description: 服务端时间戳，单位为毫秒。
                    required: true
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          properties:
            cmd:
              type: string
              const: pong
              description: Pong 响应。
              x-parser-schema-id: <anonymous-schema-120>
            code:
              type: integer
              example: 0
              description: 响应码。
              x-parser-schema-id: <anonymous-schema-121>
            message:
              type: string
              example: pong
              description: 响应消息。
              x-parser-schema-id: <anonymous-schema-122>
            data:
              type: object
              additionalProperties: false
              properties:
                timestamp:
                  type: integer
                  example: 1768976158541
                  description: 服务端时间戳，单位为毫秒。
                  x-parser-schema-id: <anonymous-schema-124>
              required:
                - timestamp
              x-parser-schema-id: <anonymous-schema-123>
          required:
            - cmd
            - code
            - message
            - data
          x-parser-schema-id: <anonymous-schema-119>
        title: Pong 响应
        description: 服务端对 ping 的响应。
        example: |-
          {
            "cmd": "<string>",
            "code": 123,
            "message": "<string>",
            "data": {
              "timestamp": 123
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: pongResponse
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: ping
  - &ref_1
    id: receivePong
    title: Receive pong
    type: receive
    messages:
      - &ref_3
        id: pingRequest
        contentType: application/json
        payload:
          - name: Ping 请求
            description: 发送 ping 检查连接状态。
            type: object
            properties:
              - name: cmd
                type: string
                description: Ping 命令，固定值。
                required: true
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          properties:
            cmd:
              type: string
              const: ping
              default: ping
              description: Ping 命令，固定值。
              x-parser-schema-id: <anonymous-schema-118>
          required:
            - cmd
          x-parser-schema-id: <anonymous-schema-117>
        title: Ping 请求
        description: 发送 ping 检查连接状态。
        example: |-
          {
            "cmd": "ping"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: pingRequest
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_1
receiveOperations:
  - *ref_2
sendMessages:
  - *ref_3
receiveMessages:
  - *ref_4
extensions:
  - id: x-parser-unique-object-id
    value: ping
securitySchemes:
  - id: apiKey
    name: api_key
    type: httpApiKey
    in: query
    extensions: []

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.