Skip to content

lobby: a lost hub offers a reconnect #371

Description

@aaylward

After MAX_RECONNECT_ATTEMPTS (10, src/utils/hubStream.ts) the lobby shows "Lost connection to the games hub" (LobbyGame's hubLost banner) and stops. Right now the only way back is a page reload. The old /thoughts page had a reconnect button on its nav ConnectionStatus (onReconnect); that page folded into /games in #368, so its users lost it too.

Fix

  • useLobby exposes reconnect(). It redials the stream (disconnect() then connect()), which is what HubWorldLink.reconnect() does today and what only useLobby.test.tsx calls. connect() clears closed, and a successful open resets reconnectAttempts, so a manual redial gets a fresh budget.
  • lost clears when the redial is admitted.
  • The hubLost banner gets a Reconnect button. LobbyPage passes onReconnect to its nav ConnectionStatus the same way.
  • Add a Reconnect entry to the command menu (lobby/thoughts: a command palette for the world's hidden commands #349/lobby: a command menu for the world's hidden commands #370), present only while lost is set.
  • Once useLobby.reconnect owns the redial, HubWorldLink.reconnect() and its redial constructor argument have no caller left; delete them.

Tests

  • useLobby: exhaust the budget (fake timers), check lost is set, call reconnect(), admit the session, then check lost is cleared and the room in the permalink is rejoined.
  • LobbyGame: the banner's button calls reconnect. The command-menu entry appears only while lost.
  • A negative: no Reconnect button or menu entry while connected.

Activity

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

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