Skip to content
ConsoleMonster
Class

DebugSocket

ConsoleMonster.Headless

Namespace
ConsoleMonster.Headless
Assembly
ConsoleMonster
Implements
IDisposable
Modifiers
sealed

An opt-in agent socket for inspecting and driving the app on a HeadlessTerminal, the way browser tests drive a page: read the screen as text or PNG, read the control tree with bounds and focus, and send keys, text, resizes and clicks. It listens on 127.0.0.1 only, requires a per-run token, masks secret patterns on every screen it sends, and never reports input values. The wire protocol (one JSON object per line) is described in Docs/Headless-Driver.md.

Inheritance

  • object
  • DebugSocket

Remarks

Nothing listens unless the host starts it: call DebugSocket.Start, or set CONSOLEMONSTER_HEADLESS=120x40 together with CONSOLEMONSTER_DEBUG_SOCKET=0 (any free port) or a port number, which starts one for the process's default headless terminal.

Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 1

Methods

public void Dispose() #

Stops listening, closes open connections and removes the discovery file.

public static DebugSocket Start(HeadlessTerminal terminal, DebugSocketOptions? options = null) #

Starts a debug socket for a headless terminal.

Parameters

terminal ConsoleMonster.Headless.HeadlessTerminal required
The terminal whose screen and input the socket exposes.
options ConsoleMonster.Headless.DebugSocketOptions? = null optional
Port, token, discovery folder and extra redaction patterns.

Returns

DebugSocket The running socket; dispose it to stop listening and remove the discovery file.

Properties

public IPEndPoint Endpoint { get; } #

The address the socket listens on: always 127.0.0.1, with the port clients connect to.

public string Token { get; } #

The token a client sends in its hello request.

public string DiscoveryPath { get; } #

The discovery file with the process id, port and token.

Fields

public const int ProtocolVersion #

The protocol version reported by hello.

Value: 1