Skip to main content

Module debug_client

Module debug_client 

Source
Expand description

The client half of the runtime debug protocol: a thin localhost WebSocket client the concinnity debug <subcommand> commands drive to talk to a running cn debug server (see super::server for the other end).

One TCP connection per request: the server answers each request on its own thread and the requests are tiny, so a fresh connection per command is simpler and more robust than holding a persistent socket. Every connect and read is bounded by a timeout, so a gone or wedged server surfaces a clear error instead of hanging. The socket-free helpers these commands use (payload validation, reply inspection, the watch-target enum) live in super::super::protocol, where they are unit-tested directly.

Subcommands: send <json> send one raw JSON command (with its own “cmd” field) and print the reply; the escape hatch for any command the typed helpers below do not cover screenshot <path> capture the last presented frame to a PNG watch <target> poll a read-only snapshot and print it until Ctrl-C

Functions§

screenshot
concinnity debug screenshot <path>: capture the last presented frame to a PNG. Resolves path to an absolute path so the file lands where the caller expects regardless of the engine’s working directory. Exits 0 only on success.
send
concinnity debug send <json>: send one raw JSON command and print the reply. Exits 0 only when the server answered "ok": true, so it composes in shell && chains; a rejected command exits 1 and a transport failure exits 3.
watch
concinnity debug watch <target>: poll a read-only snapshot every interval_ms and print each reply until Ctrl-C. A connection failure on the very first poll is fatal (exit 3) – there is nothing to watch; later failures are printed and retried, so a server restart mid-session recovers.