[next-chat] Typing indicator gets stuck when a socket disconnects mid-typing
维护者通常 1 天内回复
@officialasishkumar 已经在做这个了。
开始于 2026年11月3日。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- backend
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- TypeScript
- 星标
- 5.2k
- 派生
- 1.9k
- 平均合并
- 1 小时 4 分钟
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vercel/examples 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
CARGO-TAXI未关闭
难度 5/5 一周以上 新手友好度 10/100
维护者通常 1 天内回复
-
Better Choicez未关闭
难度 5/5 一周以上 新手友好度 15/100
vercel/examples#1584 · 2 个 reaction ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 32/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
AykutSarac/jsoncrack.com#616 ·
-
nip27: long hashtag swallows the rest of the content, lone # gives an empty hashtag可能已有人在做 @bardrop 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
nbd-wtf/nostr-tools#578 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
backnotprop/plannotator#3427 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
microsoft/Power-CAT-Copilot-Studio-Kit#942 ·
维护者通常 1 天内回复
-
[BUG]: Duplicate preposition in heading and unformatted feedback text on Strengthen Argument page未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
AOSSIE-Org/DebateAI#801 · 1 条评论 ·
维护者通常 1 天内回复