> ## 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.zh-Hant.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.