class

Obsctl::CLI::Watcher

Inherits Reference < Object

Streams daemon events to stdout as newline-delimited JSON.

watch is the scripting counterpart to the TUI: it subscribes to the same daemon topics and writes one self-describing JSON object per line, so a consumer can pipe it into jq or read it line-by-line without framing logic. Each line is flushed immediately; a buffered stream would make the command useless for reacting to events as they happen.

Constants

DEFAULT_TOPICS = TOPICS
SUBSCRIBE_ID = "watch-subscribe"
TOPICS = ["state", "events", "logs"]

Constructors

new(socket_path : String, topics : Array(String) = DEFAULT_TOPICS, stdout : IO = STDOUT, limit : Int32 | Nil = nil, session_factory : SessionFactory = ->Watcher.subscribe(String, Array(String)))
Source

Class methods

subscribe(socket_path : String, topics : Array(String)) : IPC::ClientSession

Opens a subscription session for the requested topics.

Source
validate_topics!(topics : Array(String)) : Array(String)

Validates topic names against the set the daemon publishes.

Source

Instance methods

run

Streams until the daemon closes the connection or the limit is reached.

Source

Nested types