feat(expo): 后台超过 5 分钟才断开会话 WebSocket

- 进入 background 后延迟释放长连,回到前台则取消计时;短切应用保持连接
- 池支持 subscribeConversationPoolSlotDisposed;聊天页在槽位释放时同步状态
- 前台 active 时按需 connect 或重绑会话
- backgroundDisconnectAfterMs 默认 300_000(5 分钟)

未纳入:api/uploads/ 本地文件

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kevin
2026-05-13 17:12:08 +08:00
parent 6f6ac0d550
commit c4d2a38b09
3 changed files with 96 additions and 19 deletions

View File

@@ -21,5 +21,10 @@ export const config = {
reconnectBaseDelayMs: 1_000,
reconnectMaxDelayMs: 30_000,
heartbeatIntervalMs: 30_000,
/**
* 仅当 App 处于 `background` 连续超过该毫秒数才释放当前会话 WebSocket。
* 短暂切到其它应用再返回时保持连接,避免反复重连。
*/
backgroundDisconnectAfterMs: 300_000,
},
} as const;