ssecat is a command-line tool for Server-Sent Events (SSE), similar to how curl works for regular HTTP responses.
- Streams SSE over HTTP/1.1 or HTTP/2 using Go's standard
net/httpstack. - Parses SSE according to the WHATWG EventSource format.
- Writes only event payload (
data) to stdout by default. - Writes diagnostics and errors to stderr.
- Supports automatic reconnect, with optional Last-Event-ID resume.
- Exits cleanly on
Ctrl-Cacross macOS, Linux, and Windows.
go install github.com/flaviomartins/ssecat/cmd/ssecat@latestBuilding from source requires Go 1.25.0 or newer.
Download binaries from GitHub Releases and place ssecat in your PATH.
Release binaries are built with the latest stable Go toolchain.
make buildor:
go build -o ssecat ./cmd/ssecatssecat [flags] URLFlags:
--config--state-dir--continue,-c--header(repeatable, format:Name: Value)--version--help
ssecat https://stream.wikimedia.org/v2/stream/recentchangessecat https://stream.wikimedia.org/v2/stream/recentchange | jq .ssecat https://stream.wikimedia.org/v2/stream/recentchange | grep Wikipediassecat https://stream.wikimedia.org/v2/stream/recentchange | awk 'NR<=10 {print}'Single config file:
~/.config/ssecat/.ssecatrc
Supported keys:
retry=true
retry-delay=2s
continue=false
user-agent=ssecat/0.1
accept=text/event-streamssecat stores Last-Event-ID in the user state directory:
- Linux:
~/.local/state/ssecat - macOS:
~/Library/Application Support/ssecat - Windows: system user state/config directory from Go
URL path mapping is direct (sanitized), for example:
https://stream.wikimedia.org/v2/stream/recentchange
becomes:
stream.wikimedia.org/
v2/
stream/
recentchange.last-event-id
- Initial retry delay is 3 seconds by default.
retry:fields from the server update reconnect delay.- Transport and HTTP failures use exponential backoff with jitter and cap at 30 seconds.
- Successful reconnect resets transport backoff.
- Reconnect requests include
Last-Event-IDwhen available. - Resume is disabled by default; enable with
--continue/-corcontinue=truein config.
- Config:
~/.config/ssecat/.ssecatrc - State:
~/.local/state/ssecat(or OS equivalent)
curl can stream bytes but does not natively parse SSE fields. ssecat is purpose-built for EventSource streams and reconnect semantics.
make fmt
make vet
make test
make buildContributions are welcome. Please run formatting, vet, and tests before opening pull requests.
MIT (see LICENSE).