Skip to content

BlackGlory/sse-cat

Repository files navigation

sse-cat

Command-line client for Server-Sent Events(SSE).

Install

npm install --global sse-cat
# or
yarn global add sse-cat

Install from source

yarn install
yarn build
yarn global add "file:$(pwd)"

Usage

Usage: sse-cat [options] <url...>

Command-line client for Server-Sent Events(SSE).

Options:
  -V, --version                       output the version number
  --header <header...>                Pass custom header(s) to server
  --event <name...>                   Pass custom event(s) that need to be captured
  --heartbeat-event <name>
  --heartbeat-timeout <milliseconds>
  -h, --help                          display help for command

Single SSE

sse-cat 'http://localhost:8080/sse'

Multiple SSE

sse-cat \
  'http://localhost:8080/sse/1' \
  'http://localhost:8080/sse/2'

Headers

sse-cat \
  --header 'User-Agent: sse-cat' \
  --header "Authorization: Bearer $TOKEN" \
  -- 'http://localhost:8080/sse'

Custom events

sse-cat \
  --event 'message' \
  --event 'custom-event' \
  -- 'http://localhost:8080/sse'

Heartbeat

The heartbeat checker will only be enabled when all heartbeat options are set.

sse-cat \
  --heartbeat-event heartbeat \
  --heartbeat-timeout 60000 \
  'http://localhost:8080/sse'