Skip to content

feat(channels): add WebSocket server channel and tests#2946

Merged
chengyongru merged 4 commits intoHKUDS:nightlyfrom
JackLuguibin:feat/nightly_add_ws_channel
Apr 9, 2026
Merged

feat(channels): add WebSocket server channel and tests#2946
chengyongru merged 4 commits intoHKUDS:nightlyfrom
JackLuguibin:feat/nightly_add_ws_channel

Conversation

@JackLuguibin
Copy link
Copy Markdown
Contributor

Port Python implementation from a1ec7b1 (websocket channel module and channel tests; excludes webui debug app).

Port Python implementation from a1ec7b1
(websocket channel module and channel tests; excludes webui debug app).
@JackLuguibin
Copy link
Copy Markdown
Contributor Author

@chengyongru

@chengyongru chengyongru self-requested a review April 8, 2026 14:11
- Use hmac.compare_digest for timing-safe static token comparison
- Add issued token capacity limit (_MAX_ISSUED_TOKENS=10000) with 429 response
- Use atomic pop in _take_issued_token_if_valid to eliminate TOCTOU window
- Enforce TLSv1.2 minimum version for SSL connections
- Extract _safe_send helper for consistent ConnectionClosed handling
- Move connection registration after ready send to prevent out-of-order delivery
- Add HTTP-level allow_from check and client_id truncation in process_request
- Make stop() idempotent with graceful shutdown error handling
- Normalize path via validator instead of leaving raw value
- Default websocket_requires_token to True for secure-by-default behavior
- Add integration tests and ws_test_client helper
- Refactor tests to use shared _ch factory and bus fixture
Comprehensive guide covering wire protocol, configuration reference,
token issuance, security notes, and common deployment patterns.
Copy link
Copy Markdown
Collaborator

@chengyongru chengyongru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chengyongru chengyongru merged commit 3bece17 into HKUDS:nightly Apr 9, 2026
3 checks passed
@JackLuguibin JackLuguibin deleted the feat/nightly_add_ws_channel branch April 10, 2026 15:45
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.

2 participants