Skip to content

ws: add configurable heartbeat interval with automatic restart on missed pongs #107

Description

@nagi777x

Description

Currently the WebSocket client uses a fixed heartbeat interval.
When an order-builder is dropped or the connection experiences temporary lag, heartbeats can stop (see related #91) and the client never recovers until a full reconnect.

Proposed change

  • Expose a heartbeat_interval (and optional missed_pong_threshold) in the WsConfig / client builder.
  • Automatically restart the heartbeat timer after a successful reconnect or after an order-builder is re-attached.
  • Emit a clear diagnostic event when heartbeats are restarted so consumers can observe the recovery.

Why

Makes the client more resilient under the same conditions that already cause issues #91, #88 and #86, while remaining fully backward-compatible (default values stay the same).

Checklist

  • Adds configuration option
  • Restarts heartbeat after reconnect / order-builder drop
  • Unit + integration tests
  • Docs update

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions