Basic WebSocket Client Support in CLI
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- python
- 领域
- cli, networking
调研方向
该 issue 没有指出任何文件、测试或入口点。首先定位 CLI 的 URL scheme dispatch 以及现有的连接和错误处理路径,然后跟踪请求如何发送以及其响应如何打印。完成意味着 ws:// 和 wss:// 接受一条文本消息,打印一个响应帧,处理列出的失败情况,并干净地退出。
由索引模型根据 Issue 内容生成。
描述
Checklist
- I've searched for similar feature requests.
Enhancement request
Add Basic WebSocket Client Support (ws://, wss://)
Introduce minimal WebSocket support to HTTPie CLI, allowing users to:
- Connect to a
ws://orwss://endpoint - Send a single text message via CLI argument
- Receive and print one response frame
- Exit cleanly
When a WebSocket scheme is detected, the CLI should establish a WebSocket connection instead of performing an HTTP request.
Example usage:
http ws://echo.websocket.events message="hello"
Expected behavior:
- Establish WebSocket connection
- Send the provided message as a text frame
- Print the first received text frame
- Exit successfully
Basic error handling should cover:
- Invalid WebSocket URLs
- TLS errors (
wss://) - Connection timeouts
- Unsupported/binary frames
This feature is intentionally scoped to provide minimal, non-interactive WebSocket testing support.
Problem it solves
I'm frequently testing APIs that expose both HTTP and WebSocket endpoints. While HTTPie works well for HTTP/HTTPS requests, I need to switch to another tool when validating WebSocket behavior.
I’m trying to test real-time endpoints quickly from the terminal so that I can verify message flow without leaving my CLI workflow.
Adding minimal WebSocket support would:
- Reduce context switching
- Improve developer productivity
- Make HTTPie more versatile for modern API development
Additional information, screenshots, or code examples
Proposed Scope Constraints
To keep the implementation focused and maintainable:
- No interactive REPL mode
- No continuous streaming session
- No advanced protocol extensions
- Single-message request/response flow only
Future enhancements (if needed) could extend this to streaming or interactive mode.
I would be happy to work on this enhancement and submit a pull request if the maintainers agree with the proposed scope.
- 主要语言
- Python
- 星标
- 38.6k
- 派生
- 4k
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
httpie/cli 的其他 Issue
-
new
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
bug new
难度 4/5 3-5 天 新手友好度 48/100
-
难度 3/5 1-2 天 新手友好度 55/100
-
难度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 86/100
browser-use/browser-use#5905 ·
-
type: enhancement
难度 2/5 1-3 小时 新手友好度 68/100
ynput/ayon-python-api#363 ·
-
bug needs triage
难度 2/5 1-3 小时 新手友好度 88/100
modelscope/FunASR#3728 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
open-compass/opencompass#2655 ·