alpacon event watch

Stream events from the Alpacon event channel until interrupted. Press Ctrl+C to stop.

Use it to follow something while it happens: a work session moving toward approval, a cloud integration working through servers. It never exits on its own, so when you need a single answer and then want to move on, use wait instead. See what the event channel is for the concepts behind --type and --target.

alpacon event watch --type TYPE [--target TARGET_ID]

Options

  -h, --help            help for watch
      --target string   Target resource ID; omit where the server allows a subscription without one
      --type string     Event type to subscribe to, e.g. work_session or notification (required)

The global --output flag (table or json) selects the line format.

Output

One line goes to stdout per event, and everything else—status messages and warnings—goes to stderr, so the stream stays machine-readable when piped.

The default table format prints four tab-separated fields: receive time, event type, sub type, and the target you passed to --target. The sub type and the target print as - when the event carries no value for them.

14:32:07	work_session	approved	a1b2c3d4-5678-abcd-ef01-234567890abc

That line reads as: at 14:32:07, the work session a1b2c3d4-… was approved.

With --output json, each line is the event compacted to a single line (NDJSON). Every field the server sends survives, including ones this CLI does not know about. One event per line means a consumer can read the stream incrementally instead of waiting for it to end:

alpacon event watch --type work_session --target a1b2c3d4-5678-abcd-ef01-234567890abc --output json | while read -r event; do
  echo "$event" | jq -r '.payload.sub_type'
done

Reconnection

The connection is re-established automatically when it drops, and both reconnects and failing reconnects are reported on stderr. Events published while you were disconnected are lost—the channel has no history to replay.

If the connection does not come up within 15 seconds, the command exits with an error.

Examples

Watch one work session:

alpacon event watch --type work_session --target a1b2c3d4-5678-abcd-ef01-234567890abc

Feed a script with NDJSON:

alpacon event watch --type work_session --target a1b2c3d4-5678-abcd-ef01-234567890abc --output json

Watch every notification:

alpacon event watch --type notification

Finding a target ID

Run alpacon work-session ls or open the Alpacon console.

Last updated: