AOSSIE-Org / AOSSIE-Org/DebateAI

[BUG] : WebSocket Connection Stability & Reconnection Logic

Aperta
#192 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
84
Fork
198
Merge medio
2g 19h
PR unite (30g)
30

Descrizione

## Problem
When the network drops during a live debate, `OnlineDebateRoom` does not show any connection status or recovery UI.
The screen freezes and users are forced to refresh, which often breaks the debate.

This makes real-time debates unreliable on unstable connections.

---

## What’s wrong
The WebSocket uses `ReconnectingWebSocket` but:
- No `onerror` or `onclose` handling
- No connection status in the UI
- Infinite retries with no user feedback
- RTC can fail while WebSocket looks connected

Users don’t know if the app is reconnecting or dead.

---

## Expected behavior
When the connection is lost:
- Show **Connected / Reconnecting / Disconnected**
- Show retry count (e.g. “Reconnecting 2/5”)
- Stop after a few retries
- Give buttons: **Retry** or **Leave Debate**

RTC state should also be reflected.

---

## Suggested fix
In `OnlineDebateRoom.tsx`:
- Track WebSocket state
- Add `onerror` and `onclose`
- Limit retries instead of `Infinity`
- Add a small connection status indicator

Similar logic already exists in `Matchmaking.tsx` and `ViewDebate.tsx`.

---

## Files
- `frontend/src/Pages/OnlineDebateRoom.tsx`

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.