Connections & protocols

Heartbeat

A heartbeat is a periodic signal used to check whether a connection is still responsive. WebSocket ping and pong frames are one way to perform that check.

Also found under: Ping, Pong, Keepalive

How it works

A cable disconnect or suspended device may not immediately produce a clean close event. Heartbeats and timeouts let a system detect unresponsive peers and retire stale connections. Browser WebSocket implementations handle protocol ping/pong frames; these are different from application messages called ping.

In a Pubb integration

Pubb's socket service uses ping/pong handling and connection timeouts as part of connection management. Reconnect logic and presence UI should allow for a delay between an actual network failure and its detection.

Connect a client

A practical example

A laptop loses connectivity without sending a close frame. The service eventually detects that the connection is unresponsive, while the client reconnects when network access returns.