post

fun post(method: String, params: Any = definedExternally): Promise<Void>(source)

Posts a message to the inspector back-end.

import { Session } from 'node:inspector/promises';
try {
const session = new Session();
session.connect();
const result = await session.post('Runtime.evaluate', { expression: '2 + 2' });
console.log(result);
} catch (error) {
console.error(error);
}
// Output: { result: { type: 'number', value: 4, description: '4' } }

The latest version of the V8 inspector protocol is published on the Chrome DevTools Protocol Viewer.

Node.js inspector supports all the Chrome DevTools Protocol domains declared by V8. Chrome DevTools Protocol domain provides an interface for interacting with one of the runtime agents used to inspect the application state and listen to the run-time events.


Returns supported domains.


Evaluates expression on global object.


Add handler to promise with given promise object id.


Calls function with given declaration on the given object. Object group of the result is inherited from the target object.


Returns properties of a given object. Object group of the result is inherited from the target object.


Releases remote object with given id.


Releases all remote objects that belong to a given group.


Tells inspected instance to run if it was waiting for debugger to attach.


Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context.


Disables reporting of execution contexts creation.


Discards collected exceptions and console API calls.




Compiles expression.


Runs script with given id in a given context.


Returns all let, const and class variables from global scope.


Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.


Disables debugger for given page.


Activates / deactivates all breakpoints on the page.


Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).


Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads.


Sets JavaScript breakpoint at a given location.


Removes JavaScript breakpoint.


Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.


Continues execution until specific location is reached.


Steps over the statement.


fun post(method: SessionMethod.DEBUGGER_STEPINTO, params: StepIntoParameterType = definedExternally): Promise<Void>(source)

Steps into the function call.


Steps out of the function call.


Stops on the next JavaScript statement.


This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called.


Resumes JavaScript execution.


Returns stack trace with given stackTraceId.


Searches for given string in script content.


Edits JavaScript source live.


Restarts particular call frame from the beginning.


Returns source for the script with given id.


Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none.


Evaluates expression on a given call frame.


Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.


Changes return value in top frame. Available only at return break position.


Enables or disables async call stacks tracking.


Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.


Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted.


Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification.


Disables console domain, prevents further console messages from being reported to the client.


Does nothing.


Changes CPU profiler sampling interval. Must be called before CPU profiles recording started.


Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters.


Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code.


Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started.


Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection.


Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).


Gets supported tracing categories.


fun post(method: SessionMethod.NODETRACING_START, params: StartParameterType = definedExternally): Promise<Void>(source)

Start trace events collection.


Stop trace events collection. Remaining collected events will be sent as a sequence of dataCollected events followed by tracingComplete event.


Sends protocol message over session with given id.


fun post(method: SessionMethod.NODEWORKER_ENABLE, params: EnableParameterType = definedExternally): Promise<Void>(source)

Instructs the inspector to attach to running workers. Will also attach to new workers as they start


Detaches from all running workers and disables attaching to new workers as they are started.


fun post(method: SessionMethod.NODEWORKER_DETACH, params: DetachParameterType = definedExternally): Promise<Void>(source)

Detached from the worker with given sessionId.


Enable the NodeRuntime events except by NodeRuntime.waitingForDisconnect.


Disable NodeRuntime events


Enable the NodeRuntime.waitingForDisconnect.