Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Basic WebSocket Client Support in CLI #1697

Copy link
Copy link
@Muhammad-Tayyab-Bhutto

Description

@Muhammad-Tayyab-Bhutto
Issue body actions

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:// or wss:// 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:

  1. Establish WebSocket connection
  2. Send the provided message as a text frame
  3. Print the first received text frame
  4. 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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or enhancementNew feature or enhancementnewNeeds triage. Comments are welcome!Needs triage. Comments are welcome!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.