Skip to content

Conversation

@EhabY
Copy link
Collaborator

@EhabY EhabY commented Jan 21, 2026

Summary

  • Replace multiple boolean flags with a single ConnectionState enum for clearer state management
  • Improves code readability and makes state transitions explicit

Changes

Refactored ReconnectingWebSocket to use a state machine pattern with six states:

  • IDLE - Initial state, ready to connect
  • CONNECTING - Actively running socket factory
  • CONNECTED - Socket is open and working
  • AWAITING_RETRY - Waiting for backoff timer before reconnection
  • DISCONNECTED - Temporarily paused, user must call reconnect() to resume
  • DISPOSED - Permanently closed, cannot be reused

This makes the websocket lifecycle easier to understand and debug, and prevents invalid state combinations that could
occur with independent boolean flags.

@EhabY EhabY self-assigned this Jan 21, 2026
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