Skip to content

feat(instance): add WebSocket TTY handshake protocol#12

Merged
linletian merged 1 commit intodevelopfrom
fix/refresh-prob-1
Mar 11, 2026
Merged

feat(instance): add WebSocket TTY handshake protocol#12
linletian merged 1 commit intodevelopfrom
fix/refresh-prob-1

Conversation

@linletian
Copy link
Owner

Summary

  • 实现 WebSocket TTY 握手机制,解决 PTY 就绪前的竞态条件
  • 后端在连接后发送 {"type":"ready"},前端等待该消息后再发送 resize
  • 添加 5 秒握手超时,超时后自动降级到 SSE 方案
  • 补充 PRD/API/ARCHITECTURE 文档

Changes

  • internal/app/app.go: 连接后发送 ready 消息
  • internal/ui/static/index.html: 等待 ready + 超时降级
  • docs/API.md: 补充握手协议文档
  • docs/ARCHITECTURE.md: 补充架构说明
  • docs/PRD.md: 更新实现状态

Test plan

  • 连接 WebSocket 后终端正常显示输出
  • 窗口 resize 后 TUI 程序(如 vim/htop)正确重绘
  • 超时 5 秒后自动降级到 SSE

- Server sends {"type":"ready"} after WebSocket connection
- Client waits for ready message before sending resize
- Add 5s handshake timeout with SSE fallback
- Update PRD/API/ARCHITECTURE docs to document the protocol
@linletian linletian merged commit befa6cc into develop Mar 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant