Skip to content

feat: session resumption and connection migration - #267

Merged
levibliz merged 1 commit into
RiftCore00:mainfrom
ayomidemariam:feat/session-resumption
Aug 17, 2026
Merged

feat: session resumption and connection migration#267
levibliz merged 1 commit into
RiftCore00:mainfrom
ayomidemariam:feat/session-resumption

Conversation

@ayomidemariam

@ayomidemariam ayomidemariam commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Add encrypted session state persistence so clients can resume sessions across gateway restarts or reconnections without losing room membership.

What's included

  • **** — class with AES-256-GCM encrypted storage, automatic key rotation, debounced saves, zlib compression, and both in-memory and Redis backends.
  • **** — Integrated session resumption into the connection handshake: extracts from query, attempts restore on connect, debounces saves on room join/leave, and flushes on disconnect. Adds count to .
  • **** — Flushes pending sessions and destroys the SessionManager on graceful shutdown.
  • **** — 26 unit tests covering encryption, key rotation, delete, debounce, flushPending, in-memory mode, Redis mock, blob size limits, and destroy.
  • **** — 10 integration tests covering full handshake scenarios, expired sessions, identity mismatch, debounce, room leave, metrics, and graceful shutdown.

Constraints respected

  • No changes to auth.js, validator.js, rate-limiter.js, conn-rate-limiter.js, logger.js, errors.js, room-manager.js, geofence-engine.js, protocol-registry.js, distributed-room-manager.js, tls-manager.js, or admin-server.js
  • No new npm dependencies — uses only Node.js built-in and
  • All existing tests continue to pass (225 passed, 15 skipped)

Closes #258

Add encrypted session state persistence so clients can resume sessions
across gateway restarts or reconnections without losing room membership.

SessionManager handles AES-256-GCM encrypted storage with key rotation,
debounced saves, and optional Redis or in-memory backends.

Closes RiftCore00#258, Closes RiftCore00#175, Closes RiftCore00#251, Closes RiftCore00#254
@levibliz
levibliz self-requested a review August 17, 2026 23:41
@levibliz
levibliz merged commit 544438f into RiftCore00:main Aug 17, 2026
4 checks passed
RajeshRk18 pushed a commit to RajeshRk18/Real-Time-Spatial-Tracking-Gateway that referenced this pull request Aug 18, 2026
…nto feat/session-resumption-228

Resolves conflicts with the independently merged session-resumption
implementation (RiftCore00#267) and the co-located HTTP server / backpressure
work (RiftCore00#203, RiftCore00#217, RiftCore00#218):

- src/session-manager.js: keep this branch's encrypted manager
  (AES-256-GCM + HKDF, Redis/in-memory store, debounced saves, metrics)
  over the add/add conflicting upstream variant.
- src/server.js: keep this branch's session wiring and admin migration
  endpoint; integrate upstream's /healthz, /readyz and Prometheus
  /metrics endpoints, gateway metrics counters, event-loop lag sampling
  and markShuttingDown. Session resumption counters are now exported in
  the Prometheus exposition instead of a JSON /metrics body.
- src/index.js: keep session-aware graceful shutdown; call
  markShuttingDown() on SIGTERM/SIGINT so health probes flip to 503.
- src/room-manager.js: keep ring-buffer replay/dedup/limits; restore the
  backpressure-aware broadcast wiring (constructor options, client
  state tracking and cleanup) that upstream's copy referenced but never
  initialized.
- tests: keep this branch's session-manager and resumption integration
  suites; update /metrics assertions to the Prometheus format.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012uUSA8xm8WNue2Cw1mj1zM
RajeshRk18 added a commit to RajeshRk18/Real-Time-Spatial-Tracking-Gateway that referenced this pull request Aug 18, 2026
…nto feat/session-resumption-228

Resolves conflicts with the independently merged session-resumption
implementation (RiftCore00#267) and the co-located HTTP server / backpressure
work (RiftCore00#203, RiftCore00#217, RiftCore00#218):

- src/session-manager.js: keep this branch's encrypted manager
  (AES-256-GCM + HKDF, Redis/in-memory store, debounced saves, metrics)
  over the add/add conflicting upstream variant.
- src/server.js: keep this branch's session wiring and admin migration
  endpoint; integrate upstream's /healthz, /readyz and Prometheus
  /metrics endpoints, gateway metrics counters, event-loop lag sampling
  and markShuttingDown. Session resumption counters are now exported in
  the Prometheus exposition instead of a JSON /metrics body.
- src/index.js: keep session-aware graceful shutdown; call
  markShuttingDown() on SIGTERM/SIGINT so health probes flip to 503.
- src/room-manager.js: keep ring-buffer replay/dedup/limits; restore the
  backpressure-aware broadcast wiring (constructor options, client
  state tracking and cleanup) that upstream's copy referenced but never
  initialized.
- tests: keep this branch's session-manager and resumption integration
  suites; update /metrics assertions to the Prometheus format.
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.

2 participants