feat(server): implement WebSocket TTY for interactive terminal sessions#397
Merged
Conversation
…al sessions (#397) Replace the last remaining 501 stub with a full WebSocket TTY implementation. All 33 OpenAPI endpoints are now fully implemented. The handler multiplexes four existing gRPC RPCs (Exec, StreamOutput, SendInput, ResizeTty) over a single WebSocket connection: - Client binary frames → SendInput (stdin bytes) - Server binary frames ← StreamOutput (PTY output) - Client text frames → ResizeTty (JSON resize commands) - Server text frames ← exit notification with exit code Implementation details: - Enable axum "ws" feature for WebSocketUpgrade extractor - Pre-upgrade validation checks box existence before handshake - Concurrent reader/writer tasks via tokio::select! - Add TtyQuery type with defaults (bash, 80x24) - Add unit tests for TtyQuery serde and integration tests for WebSocket upgrade requirement and query parameter handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the last remaining 501 stub with a full WebSocket TTY implementation. All 33 OpenAPI endpoints are now fully implemented — zero stubs remaining.
The handler multiplexes four existing gRPC RPCs over a single WebSocket:
SendInput(stdin bytes)StreamOutput(PTY output)ResizeTty(JSON resize commands)Changes:
wsfeature forWebSocketUpgradeextractortokio::select!TtyQuerytype with defaults (bash, 80x24)Test plan
cargo test -p boxlite-server— 118 tests pass (68 unit + 44 integration + 6 conformance)cargo clippy -p boxlite-server --tests -- -D warnings— zero warningscargo fmt -p boxlite-server -- --check— cleanwebsocatto verify stdin/stdout/resize