AOSSIE-Org / AOSSIE-Org/DebateAI

[BUG] : WebSocket Connection Stability & Reconnection Logic

Đang mở
#192 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
84
Fork
198
Merge trung bình
2 ngày 19 giờ
Pull request đã merge (30 ngày)
30

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.