Skip to content

fix(feed): add ping_interval/ping_timeout to prevent zombie WebSocket#3

Open
AkhilSharma1 wants to merge 1 commit intomarketcalls:masterfrom
AkhilSharma1:fix/websocket-ping-keepalive
Open

fix(feed): add ping_interval/ping_timeout to prevent zombie WebSocket#3
AkhilSharma1 wants to merge 1 commit intomarketcalls:masterfrom
AkhilSharma1:fix/websocket-ping-keepalive

Conversation

@AkhilSharma1
Copy link
Copy Markdown

@AkhilSharma1 AkhilSharma1 commented Mar 30, 2026

Without ping_interval, run_forever() never sends WebSocket pings. On unreliable connections (e.g. India VPS), the TCP socket can appear OPEN at the OS level while the broker has silently stopped streaming ticks. This is the "zombie WebSocket" problem: the client never sees an error or disconnect, so on_close never fires and reconnect logic never runs.

Setting ping_interval=20 causes websocket-client to send a ping frame every 20 seconds. If the pong is not received within ping_timeout=10s, the library closes the socket and fires on_close, allowing callers to detect the drop and reconnect.


Summary by cubic

Add WebSocket keepalive to prevent zombie connections. We now run websocket-client with ping_interval=20 and ping_timeout=10, which sends a ping every 20s and closes if no pong in 10s so on_close fires and reconnect logic runs.

Written for commit 9ee86a7. Summary will update on new commits.

Without ping_interval, run_forever() never sends WebSocket pings.
On unreliable connections (e.g. India VPS), the TCP socket can appear
OPEN at the OS level while the broker has silently stopped streaming
ticks. This is the "zombie WebSocket" problem: the client never sees
an error or disconnect, so on_close never fires and reconnect logic
never runs.

Setting ping_interval=20 causes websocket-client to send a ping frame
every 20 seconds. If the pong is not received within ping_timeout=10s,
the library closes the socket and fires on_close, allowing callers to
detect the drop and reconnect.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant