Skip to content

Feature request: Support streaming response for long-running commands #750

@jankenliu

Description

@jankenliu

Hi there,

First of all, thanks for this great project! It's incredibly useful for triggering scripts via webhooks.

I have a feature request: support for streaming the output of long-running commands back to the client in real time.

Current behavior
When include-command-output-in-response is set to true, webhook waits for the command to finish completely and then sends the entire output (stdout/stderr) in one single response chunk. This works well for short commands, but for longer tasks (e.g., deployment scripts, backups, data processing), the client has to wait until the command finishes before seeing any output.

Desired behavior
I'd like to have an option to stream the output incrementally as the command produces it. This would allow clients to see progress logs in real time, which greatly improves the user experience for long-running operations.

Use cases
Deployment pipelines that print progress steps.

Backup scripts that output file names or status.

Any command that runs for several seconds/minutes and benefits from live feedback.

Possible implementation idea
One way to achieve this is to:

Use HTTP chunked transfer encoding (or Server-Sent Events) to send data as it arrives.

Read the command's stdout/stderr line by line (or in small buffers) and immediately write each chunk to the HTTP response stream.

Flush the response after each write.

Ensure that each request gets its own independent response stream (concurrent calls should not interfere).

A new configuration flag like stream-output: true (or maybe include-command-output-in-response could imply streaming when combined with another flag) would allow users to opt into this behavior without breaking existing setups.

Additional notes
Error handling: if the command fails, the stream could still send partial output and then close with an appropriate HTTP status (or keep the connection open until the end and then set the status). A simple approach might be to send a final trailer with the exit code.

Compatibility: this feature should be optional to maintain backward compatibility.

Best regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions