AOSSIE-Org / AOSSIE-Org/DebateAI

[BUG] : WebSocket Connection Stability & Reconnection Logic

Abierto
#192 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
84
Forks
198
Merge medio
2 d 19 h
PR fusionados (30 d)
30

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.