AOSSIE-Org / AOSSIE-Org/DebateAI

[BUG] : WebSocket Connection Stability & Reconnection Logic

Ouverte
#192 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
84
Forks
198
Merge moyen
2 j 19 h
PR mergées (30 j)
30

Description

## 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`

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.