[next-chat] Typing indicator gets stuck when a socket disconnects mid-typing
I maintainer di solito rispondono entro 1 giorno
@officialasishkumar ci sta già lavorando.
Dal 3/11/2026.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend
Direzione di ricerca
Start with ChatHub.handleClose in lib/chat/index.ts, which currently ignores typing state, and the typingUsers handling in lib/chatReducer.ts. Reproduce by mounting ChatHub on a plain ws server: one client sends { type: 'typing' } and is terminated, and the other should receive a stop typing frame. Done when a closing typist's peers get a stop typing for that user, and a rejoining client drops typing entries it can no longer trust.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
In websockets/next-chat, the "X is typing" indicator can get stuck on other users' screens indefinitely.
There are two paths:
- Typist disconnects mid-typing. The client sends
typingon the first keystroke and relies on a 900 ms idle timer to sendstop typing. If the socket drops before that timer fires (closed tab, network blip, laptop sleep),send()is a no-op on the dead socket, sostop typingis never delivered.ChatHub.handleClose(lib/chat/index.ts) does nothing about typing state, so every peer keeps showing "alice is typing".- If the user reconnects within the presence staleness window (
PRESENCE_STALE_MS, 20 s by default), nouser leftframe is broadcast either. That frame is the only other thing that clearstypingUsersinlib/chatReducer.ts, so the indicator never clears.
- If the user reconnects within the presence staleness window (
- Viewer disconnects while someone stops typing. If a viewer's own socket is down when a peer's
stop typingis broadcast, the viewer misses it. After reconnecting, the viewer still shows the stale typing entry, because theloginframe sent on rejoin leavestypingUsersunchanged.
Steps to reproduce
- Open the chat in two tabs and join as
aliceandbob. - In alice's tab, start typing, then within ~1 s kill alice's connection (close the tab, or go offline in DevTools and back online).
- bob's tab keeps showing "alice is typing". If alice reconnects quickly, it never clears.
I also reproduced this outside the browser by mounting ChatHub on a plain ws server. Two clients join, one sends { type: 'typing' } and is then terminated, and the other client never receives a stop typing frame.
Expected
When a typing socket closes, peers should get a stop typing for that user. A client that rejoins after a disconnect should drop typing state it can no longer trust.
- Lingua principale
- TypeScript
- Stelle
- 5.2k
- Fork
- 1.9k
- Merge medio
- 1h 4m
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di vercel/examples
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
CARGO-TAXIAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
I maintainer di solito rispondono entro 1 giorno
-
Better ChoicezAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
vercel/examples#1584 · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
onbeat landing pageAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di vercel/examples
Issue simili
-
Add: BOM CineApertaapproved check:passed streams:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug platform-android
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Termix-SSH/Mobile#146 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
MCP mcp-feedback-pattern
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
getsentry/toolkit#2276 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
devswha/herdr-web-ui#3875 ·