Skip to content

fix(realtime): connection closed transition expires token#201

Merged
noahgsolomon merged 1 commit intomainfrom
noah/fix-realtime-connection-closed-transition
Feb 27, 2026
Merged

fix(realtime): connection closed transition expires token#201
noahgsolomon merged 1 commit intomainfrom
noah/fix-realtime-connection-closed-transition

Conversation

@noahgsolomon
Copy link
Contributor

@noahgsolomon noahgsolomon commented Feb 25, 2026

expire the token on connectionClosed and close so reconnects always re-authenticate instead of reusing a stale token.

The active state had no handler for token expiry, so tokens
were never refreshed. Replace the broken expireToken approach
with a recurring background fetch that updates the token
in-place via a new authenticated transition, keeping the
WebSocket open. Use a generation counter to prevent stale
callbacks from spawning parallel refresh loops. Also expire
the token on connectionClosed and close so reconnects always
re-authenticate instead of reusing a stale token.
@noahgsolomon noahgsolomon changed the title fix(realtime): refresh tokens in background and clear on disconnect fix(realtime): connection closed transition expires token Feb 25, 2026
@noahgsolomon noahgsolomon merged commit 5a97ffa into main Feb 27, 2026
1 check passed
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