Skip to content

Function: discoverSockets()

ts
function discoverSockets(): {
  cwd?: string;
  path: string;
  pid: number;
}[];

Defined in: packages/core/src/observability/TelemetryBus.ts:159

Discover active telemetry sockets by scanning the registry directory. Works on Windows, Mac, and Linux.

Reads {REGISTRY_DIR}/*.json marker files written by running servers. Each file contains { pid, path }. Stale files from crashed processes (e.g. SIGKILL where cleanup handlers never run) are detected via PID probing and automatically cleaned up.

Returns

{ cwd?: string; path: string; pid: number; }[]

Array of discovered sockets with their PIDs