Skip to content

DevToolsServer

Runs the server side of the unstable Effect devtools socket protocol.

Use this module when an integration needs to accept devtools clients over a SocketServer, decode newline-delimited JSON messages, and handle each connection with application-specific logic. It does not interpret spans or metrics itself; it gives handlers a typed surface for the telemetry described by DevToolsSchema.

2 exports Added in v4.0.0 Source

Constructors

run

Added in v4.0.0 Source

Runs the devtools socket server.

Details

Each connection is decoded as NDJSON devtools protocol messages, Ping requests are answered with Pong, and all other requests are delivered through the Client passed to the handler.

Signature

declare const run: <_, E, R>(
  handle: (client: Client) => Effect.Effect<_, E, R>,
) => Effect.Effect<never, SocketServer.SocketServerError, R | SocketServer.SocketServer>;

Models

Client interface

Added in v4.0.0 Source

Handle for a connected devtools client.

Details

It exposes a queue of non-ping requests received from the socket and a send function for non-pong responses.

Signature

interface Client {
  readonly queue: Dequeue<WithoutPing>;
  readonly send: (_: { readonly _tag: "MetricsRequest" }) => Effect<void>;
}