LIVE
$7.62 min profit is yours / per trade
Get the bot

Definition

Heartbeat

A periodic message that keeps a WebSocket alive.

Definition

A WebSocket heartbeat is a periodic message sent over a WebSocket connection to confirm the connection is still live. On Polymarket's market WebSocket, the server expects a PING every 10 seconds; missing heartbeats can cause the server or intermediaries to drop the connection.

In context

When you subscribe to Polymarket's market feed (wss://ws-subscriptions-clob.polymarket.com/ws/market), the connection lifecycle depends on regular heartbeats. The server emits market events (best_bid_ask, last_trade_price, price_change, tick_size_change) and expects a PING at roughly 10-second intervals to avoid timeouts. Implementations should both respond to incoming PING/PONG frames and send periodic PINGs from the client side if the transport or intermediary may close idle sockets.

Practical notes

  • Use a timer slightly shorter than 10 seconds (for example, 9–10 seconds) to tolerate network jitter and processing delays.
  • Handle missed heartbeats by attempting a clean reconnect and resubscribing to your instruments. Reconnect logic should include backoff to avoid thundering herds.
  • Respect the 500-instrument-per-connection limit when resubscribing; the WebSocket will reject oversized subscription requests.

See also

  • /glossary/market-channel

Related terms