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

# Heartbeats

> Real-time server pings (every second) to keep all connections open. Each
message carries a heartbeat_counter so clients can detect missed messages.
No products or authentication required.




## AsyncAPI

````yaml api-reference/advanced-trade-api/advanced-trade-asyncapi.json heartbeats
id: heartbeats
title: Heartbeats
description: |
  Real-time server pings (every second) to keep all connections open. Each
  message carries a heartbeat_counter so clients can detect missed messages.
  No products or authentication required.
servers:
  - id: production
    protocol: wss
    host: advanced-trade-ws.coinbase.com
    bindings: []
    variables: []
address: heartbeats
parameters: []
bindings: []
operations:
  - &ref_2
    id: heartbeatsSubscribe
    title: Subscribe to heartbeats
    description: >-
      Client sends a subscribe or unsubscribe request for the heartbeats
      channel.
    type: receive
    messages:
      - &ref_4
        id: subscribe_request
        contentType: application/json
        payload:
          - name: Subscription request
            description: Subscribe or unsubscribe to the heartbeats channel.
            type: object
            properties:
              - name: type
                type: string
                enumValues:
                  - subscribe
                  - unsubscribe
                required: true
              - name: channel
                type: string
                required: true
              - name: jwt
                type: string
                description: CDP JWT. Optional; recommended for connection reliability.
                required: false
        headers: []
        jsonPayloadSchema:
          type: object
          additionalProperties: false
          required:
            - type
            - channel
          properties:
            type:
              type: string
              enum:
                - subscribe
                - unsubscribe
              default: subscribe
              x-parser-schema-id: <anonymous-schema-2>
            channel:
              type: string
              default: heartbeats
              x-parser-schema-id: <anonymous-schema-3>
            jwt:
              type: string
              description: CDP JWT. Optional; recommended for connection reliability.
              x-parser-schema-id: <anonymous-schema-4>
          x-parser-schema-id: <anonymous-schema-1>
        title: Subscription request
        description: Subscribe or unsubscribe to the heartbeats channel.
        example: |-
          {
            "type": "subscribe",
            "channel": "heartbeats"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: subscribe_request
    bindings: []
    extensions: &ref_1
      - id: x-parser-unique-object-id
        value: heartbeats
  - &ref_3
    id: heartbeatsStream
    title: Heartbeat stream
    description: Server streams heartbeat messages to subscribed clients.
    type: send
    messages:
      - &ref_5
        id: heartbeat
        contentType: application/json
        payload:
          - allOf: &ref_0
              - type: object
                properties:
                  channel:
                    type: string
                    description: The channel that produced this message.
                    x-parser-schema-id: <anonymous-schema-5>
                  timestamp:
                    type: string
                    format: date-time
                    description: Server time the message was sent (RFC 3339).
                    x-parser-schema-id: <anonymous-schema-6>
                  sequence_num:
                    type: integer
                    description: >-
                      Per-connection message sequence number; use it to detect
                      dropped or out-of-order messages.
                    x-parser-schema-id: <anonymous-schema-7>
                x-parser-schema-id: EnvelopeBase
              - type: object
                properties:
                  channel:
                    const: heartbeats
                    x-parser-schema-id: <anonymous-schema-9>
                  events:
                    type: array
                    items:
                      type: object
                      properties:
                        current_time:
                          type: string
                          x-parser-schema-id: <anonymous-schema-12>
                        heartbeat_counter:
                          type: integer
                          description: >-
                            Increments each heartbeat; verifies no messages were
                            missed.
                          x-parser-schema-id: <anonymous-schema-13>
                      x-parser-schema-id: <anonymous-schema-11>
                    x-parser-schema-id: <anonymous-schema-10>
                x-parser-schema-id: <anonymous-schema-8>
            x-parser-schema-id: HeartbeatEnvelope
            name: Heartbeat message
        headers: []
        jsonPayloadSchema:
          allOf: *ref_0
          x-parser-schema-id: HeartbeatEnvelope
        title: Heartbeat message
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: heartbeat
    bindings: []
    extensions: *ref_1
sendOperations:
  - *ref_2
receiveOperations:
  - *ref_3
sendMessages:
  - *ref_4
receiveMessages:
  - *ref_5
extensions:
  - id: x-parser-unique-object-id
    value: heartbeats
securitySchemes: []

````