Skip to content

[Web] WebSocket reconnection needs exponential backoff with jitter #387

@Flegma

Description

@Flegma

Summary

WebSocket reconnection uses a fixed 1-second delay with no backoff, jitter, or max retry limit.

Findings

  • Socket.ts — setTimeout(() => this.connect(), 1000) on every close event. No backoff or retry limit.

Impact

During outages, all clients hammer the server every second. Thundering herd on recovery. Battery drain on mobile.

Suggested Fix

Implement exponential backoff (1s, 2s, 4s, 8s... up to 30s) with random jitter. Add max retry limit with user notification.


Related Issues (WebSocket/Networking Pattern)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-highStability & reliabilityaudit-2026-03From March 2026 codebase auditnetworkingWebSocket, WebRTC, or network issueservice:web5stackgg/web service

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions