feat(backend): implement WebSocket session management - #1028
Merged
Hydrax117 merged 4 commits intoAug 31, 2026
Merged
Conversation
- Heartbeat every 30s with 90s timeout (3 missed beats closes connection) - Preserved session state for 60s window to restore subscriptions on reconnect - Enforce max 5 concurrent connections per user - Track reconnect metrics (count, failures, expired) - Fix codebase compilation and add comprehensive session registry tests Closes Arenax-gaming#870
|
@Fang0067 is attempting to deploy a commit to the paul joseph's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Fang0067 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
- Resolve conflicts in middleware/mod.rs, reputation_service.rs, and tournament_service.rs - Add prometheus dependencies to support metrics export - Maintain all WebSocket session management implementations for Issue Arenax-gaming#870
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Implements WebSocket session management in
arenax-backendfeaturing heartbeat management, timeout enforcement, session state preservation across reconnects, connection concurrency limiting per user, and reconnection metrics tracking.Related Issue
Closes #870
Changes
WebSocket Realtime Session Management
backend/src/realtime/session_registry.rsHEARTBEAT_INTERVAL(30s),CLIENT_TIMEOUT(90s / 3 missed heartbeats),STATE_PRESERVATION_TTL(60s), andMAX_CONNECTIONS_PER_USER(5).PreservedSession) during disconnection to allow client subscription restoration upon reconnection within 60s.reconnecthandler to restore subscriptions, enforce user validation, and maintain reconnect metrics (reconnect_count,reconnect_failures,reconnect_expired).registerandregister_with_limit.backend/src/realtime/user_ws.rsbackend/tests/session_registry_test.rsVerification Results
HEARTBEAT_INTERVAL = Duration::from_secs(30))session_registry.rs&user_ws.rsCLIENT_TIMEOUT = Duration::from_secs(90))session_registry.rs&user_ws.rsSTATE_PRESERVATION_TTL = Duration::from_secs(60))session_registry.rsMAX_CONNECTIONS_PER_USER = 5)session_registry.rs&user_ws.rsreconnect_count,reconnect_failures,reconnect_expired)session_registry.rs