mirror of
https://github.com/kuaifan/dootask.git
synced 2026-07-31 02:15:57 +00:00
1.9 KiB
1.9 KiB
id, title, type, feature, scope, locale, aliases, related_tools, related_pages, prerequisites, negative, last_verified
| id | title | type | feature | scope | locale | aliases | related_tools | related_pages | prerequisites | negative | last_verified | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| common-faq.sync-websocket-disconnect.faq | WebSocket 频繁断开 / 一直显示「连接中」 | faq | common-faq | end-user | zh |
|
|
v1.7.90 |
WebSocket 频繁断开 / 一直显示「连接中」
问题
页面右下角的连接状态频繁在「已连接」「已断开」「连接中」之间切换;或者持续显示「连接中」始终连不上。
常见原因 + 排查
1. 反向代理超时太短 nginx / Apache / 云 LB 默认 60s 后空闲断开 WebSocket。需要:
- nginx:
proxy_read_timeout 3600s;和proxy_send_timeout 3600s; - 必须支持
Upgrade+Connection头透传
2. HTTPS 部署没开 WSS 如果站点是 https 但 WebSocket 走 ws://(不带 s),浏览器会拒绝。后端要同时支持 wss(自动跟随 https)。
3. 客户端网络不稳定
- 公司代理 / 防火墙拦截长连接
- 移动设备切 WiFi / 4G 触发重连
- 浏览器后台休眠超过几分钟会被系统挂起
4. 后端 Swoole 进程异常
后端日志看 storage/logs/laravel.log,搜 WebSocket 关键字。
解决
- 刷新浏览器 → 重新建立连接
- 看右下角连接状态:等几秒看是否自动重连
- 管理员:检查 nginx 反代配置(timeout、Upgrade 头)
- 管理员:
./cmd php restart重启后端 Swoole 进程 - 桌面端 / 移动端 App 杀进程重开