Skip to main content
method Session.prototype.post
unstable
Session.prototype.post(
method: string,
params?: object,
): Promise<void>
Deprecated

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.

Parameters

method: string
optional
params: object

Return Type

Promise<void>
Session.prototype.post(method: "Schema.getDomains"): Promise<Schema.GetDomainsReturnType>
Deprecated

Returns supported domains.

Parameters

method: "Schema.getDomains"

Return Type

Session.prototype.post(
method: "Runtime.evaluate",
): Promise<Runtime.EvaluateReturnType>
Deprecated

Evaluates expression on global object.

Parameters

method: "Runtime.evaluate"

Return Type

Session.prototype.post(
method: "Runtime.awaitPromise",
): Promise<Runtime.AwaitPromiseReturnType>
Deprecated

Add handler to promise with given promise object id.

Parameters

method: "Runtime.awaitPromise"

Return Type

Session.prototype.post(
method: "Runtime.callFunctionOn",
): Promise<Runtime.CallFunctionOnReturnType>
Deprecated

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

Parameters

method: "Runtime.callFunctionOn"

Return Type

Session.prototype.post(
method: "Runtime.getProperties",
): Promise<Runtime.GetPropertiesReturnType>
Deprecated

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

Parameters

method: "Runtime.getProperties"

Return Type

Session.prototype.post(
method: "Runtime.releaseObject",
): Promise<void>
Deprecated

Releases remote object with given id.

Parameters

method: "Runtime.releaseObject"

Return Type

Promise<void>
Session.prototype.post(
method: "Runtime.releaseObjectGroup",
): Promise<void>
Deprecated

Releases all remote objects that belong to a given group.

Parameters

method: "Runtime.releaseObjectGroup"

Return Type

Promise<void>
Session.prototype.post(method: "Runtime.runIfWaitingForDebugger"): Promise<void>
Deprecated

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

Parameters

method: "Runtime.runIfWaitingForDebugger"

Return Type

Promise<void>
Session.prototype.post(method: "Runtime.enable"): Promise<void>
Deprecated

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.

Parameters

method: "Runtime.enable"

Return Type

Promise<void>
Session.prototype.post(method: "Runtime.disable"): Promise<void>
Deprecated

Disables reporting of execution contexts creation.

Parameters

method: "Runtime.disable"

Return Type

Promise<void>
Session.prototype.post(method: "Runtime.discardConsoleEntries"): Promise<void>
Deprecated

Discards collected exceptions and console API calls.

Parameters

method: "Runtime.discardConsoleEntries"

Return Type

Promise<void>
Session.prototype.post(
method: "Runtime.setCustomObjectFormatterEnabled",
): Promise<void>
Deprecated

Parameters

method: "Runtime.setCustomObjectFormatterEnabled"

Return Type

Promise<void>
Session.prototype.post(
method: "Runtime.compileScript",
): Promise<Runtime.CompileScriptReturnType>
Deprecated

Compiles expression.

Parameters

method: "Runtime.compileScript"

Return Type

Session.prototype.post(
method: "Runtime.runScript",
): Promise<Runtime.RunScriptReturnType>
Deprecated

Runs script with given id in a given context.

Parameters

method: "Runtime.runScript"

Return Type

Session.prototype.post(
method: "Runtime.queryObjects",
): Promise<Runtime.QueryObjectsReturnType>
Deprecated

Parameters

method: "Runtime.queryObjects"

Return Type

Session.prototype.post(
method: "Runtime.globalLexicalScopeNames",
): Promise<Runtime.GlobalLexicalScopeNamesReturnType>
Deprecated

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

Parameters

method: "Runtime.globalLexicalScopeNames"

Return Type

Session.prototype.post(method: "Debugger.enable"): Promise<Debugger.EnableReturnType>
Deprecated

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

Parameters

method: "Debugger.enable"

Return Type

Session.prototype.post(method: "Debugger.disable"): Promise<void>
Deprecated

Disables debugger for given page.

Parameters

method: "Debugger.disable"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.setBreakpointsActive",
): Promise<void>
Deprecated

Activates / deactivates all breakpoints on the page.

Parameters

method: "Debugger.setBreakpointsActive"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.setSkipAllPauses",
): Promise<void>
Deprecated

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

Parameters

method: "Debugger.setSkipAllPauses"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.setBreakpointByUrl",
): Promise<Debugger.SetBreakpointByUrlReturnType>
Deprecated

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.

Parameters

method: "Debugger.setBreakpointByUrl"

Return Type

Session.prototype.post(
method: "Debugger.setBreakpoint",
): Promise<Debugger.SetBreakpointReturnType>
Deprecated

Sets JavaScript breakpoint at a given location.

Parameters

method: "Debugger.setBreakpoint"

Return Type

Session.prototype.post(
method: "Debugger.removeBreakpoint",
): Promise<void>
Deprecated

Removes JavaScript breakpoint.

Parameters

method: "Debugger.removeBreakpoint"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.getPossibleBreakpoints",
): Promise<Debugger.GetPossibleBreakpointsReturnType>
Deprecated

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

Parameters

method: "Debugger.getPossibleBreakpoints"

Return Type

Session.prototype.post(
method: "Debugger.continueToLocation",
): Promise<void>
Deprecated

Continues execution until specific location is reached.

Parameters

method: "Debugger.continueToLocation"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.pauseOnAsyncCall",
): Promise<void>
Deprecated

Parameters

method: "Debugger.pauseOnAsyncCall"

Return Type

Promise<void>
Session.prototype.post(method: "Debugger.stepOver"): Promise<void>
Deprecated

Steps over the statement.

Parameters

method: "Debugger.stepOver"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.stepInto",
): Promise<void>
Deprecated

Steps into the function call.

Parameters

method: "Debugger.stepInto"

Return Type

Promise<void>
Session.prototype.post(method: "Debugger.stepOut"): Promise<void>
Deprecated

Steps out of the function call.

Parameters

method: "Debugger.stepOut"

Return Type

Promise<void>
Session.prototype.post(method: "Debugger.pause"): Promise<void>
Deprecated

Stops on the next JavaScript statement.

Parameters

method: "Debugger.pause"

Return Type

Promise<void>
Session.prototype.post(method: "Debugger.scheduleStepIntoAsync"): Promise<void>
Deprecated

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.

Parameters

method: "Debugger.scheduleStepIntoAsync"

Return Type

Promise<void>
Session.prototype.post(method: "Debugger.resume"): Promise<void>
Deprecated

Resumes JavaScript execution.

Parameters

method: "Debugger.resume"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.getStackTrace",
): Promise<Debugger.GetStackTraceReturnType>
Deprecated

Returns stack trace with given stackTraceId.

Parameters

method: "Debugger.getStackTrace"

Return Type

Session.prototype.post(
method: "Debugger.searchInContent",
): Promise<Debugger.SearchInContentReturnType>
Deprecated

Searches for given string in script content.

Parameters

method: "Debugger.searchInContent"

Return Type

Session.prototype.post(
method: "Debugger.setScriptSource",
): Promise<Debugger.SetScriptSourceReturnType>
Deprecated

Edits JavaScript source live.

Parameters

method: "Debugger.setScriptSource"

Return Type

Session.prototype.post(
method: "Debugger.restartFrame",
): Promise<Debugger.RestartFrameReturnType>
Deprecated

Restarts particular call frame from the beginning.

Parameters

method: "Debugger.restartFrame"

Return Type

Session.prototype.post(
method: "Debugger.getScriptSource",
): Promise<Debugger.GetScriptSourceReturnType>
Deprecated

Returns source for the script with given id.

Parameters

method: "Debugger.getScriptSource"

Return Type

Session.prototype.post(
method: "Debugger.setPauseOnExceptions",
): Promise<void>
Deprecated

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.

Parameters

method: "Debugger.setPauseOnExceptions"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.evaluateOnCallFrame",
): Promise<Debugger.EvaluateOnCallFrameReturnType>
Deprecated

Evaluates expression on a given call frame.

Parameters

method: "Debugger.evaluateOnCallFrame"

Return Type

Session.prototype.post(
method: "Debugger.setVariableValue",
): Promise<void>
Deprecated

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

Parameters

method: "Debugger.setVariableValue"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.setReturnValue",
): Promise<void>
Deprecated

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

Parameters

method: "Debugger.setReturnValue"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.setAsyncCallStackDepth",
): Promise<void>
Deprecated

Enables or disables async call stacks tracking.

Parameters

method: "Debugger.setAsyncCallStackDepth"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.setBlackboxPatterns",
): Promise<void>
Deprecated

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.

Parameters

method: "Debugger.setBlackboxPatterns"

Return Type

Promise<void>
Session.prototype.post(
method: "Debugger.setBlackboxedRanges",
): Promise<void>
Deprecated

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.

Parameters

method: "Debugger.setBlackboxedRanges"

Return Type

Promise<void>
Session.prototype.post(method: "Console.enable"): Promise<void>
Deprecated

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

Parameters

method: "Console.enable"

Return Type

Promise<void>
Session.prototype.post(method: "Console.disable"): Promise<void>
Deprecated

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

Parameters

method: "Console.disable"

Return Type

Promise<void>
Session.prototype.post(method: "Console.clearMessages"): Promise<void>
Deprecated

Does nothing.

Parameters

method: "Console.clearMessages"

Return Type

Promise<void>
Session.prototype.post(method: "Profiler.enable"): Promise<void>
Deprecated

Parameters

method: "Profiler.enable"

Return Type

Promise<void>
Session.prototype.post(method: "Profiler.disable"): Promise<void>
Deprecated

Parameters

method: "Profiler.disable"

Return Type

Promise<void>
Session.prototype.post(
method: "Profiler.setSamplingInterval",
): Promise<void>
Deprecated

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

Parameters

method: "Profiler.setSamplingInterval"

Return Type

Promise<void>
Session.prototype.post(method: "Profiler.start"): Promise<void>
Deprecated

Parameters

method: "Profiler.start"

Return Type

Promise<void>
Session.prototype.post(method: "Profiler.stop"): Promise<Profiler.StopReturnType>
Deprecated

Parameters

method: "Profiler.stop"

Return Type

Session.prototype.post(
method: "Profiler.startPreciseCoverage",
): Promise<void>
Deprecated

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.

Parameters

method: "Profiler.startPreciseCoverage"

Return Type

Promise<void>
Session.prototype.post(method: "Profiler.stopPreciseCoverage"): Promise<void>
Deprecated

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

Parameters

method: "Profiler.stopPreciseCoverage"

Return Type

Promise<void>
Session.prototype.post(method: "Profiler.takePreciseCoverage"): Promise<Profiler.TakePreciseCoverageReturnType>
Deprecated

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

Parameters

method: "Profiler.takePreciseCoverage"

Return Type

Session.prototype.post(method: "Profiler.getBestEffortCoverage"): Promise<Profiler.GetBestEffortCoverageReturnType>
Deprecated

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

Parameters

method: "Profiler.getBestEffortCoverage"

Return Type

Session.prototype.post(method: "HeapProfiler.enable"): Promise<void>
Deprecated

Parameters

method: "HeapProfiler.enable"

Return Type

Promise<void>
Session.prototype.post(method: "HeapProfiler.disable"): Promise<void>
Deprecated

Parameters

method: "HeapProfiler.disable"

Return Type

Promise<void>
Session.prototype.post(
method: "HeapProfiler.startTrackingHeapObjects",
): Promise<void>
Deprecated

Parameters

method: "HeapProfiler.startTrackingHeapObjects"

Return Type

Promise<void>
Session.prototype.post(
method: "HeapProfiler.stopTrackingHeapObjects",
): Promise<void>
Deprecated

Parameters

method: "HeapProfiler.stopTrackingHeapObjects"

Return Type

Promise<void>
Session.prototype.post(
method: "HeapProfiler.takeHeapSnapshot",
): Promise<void>
Deprecated

Parameters

method: "HeapProfiler.takeHeapSnapshot"

Return Type

Promise<void>
Session.prototype.post(method: "HeapProfiler.collectGarbage"): Promise<void>
Deprecated

Parameters

method: "HeapProfiler.collectGarbage"

Return Type

Promise<void>
Session.prototype.post(
method: "HeapProfiler.getObjectByHeapObjectId",
): Promise<HeapProfiler.GetObjectByHeapObjectIdReturnType>
Deprecated

Parameters

method: "HeapProfiler.getObjectByHeapObjectId"

Return Type

Session.prototype.post(
method: "HeapProfiler.addInspectedHeapObject",
): Promise<void>
Deprecated

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

Parameters

method: "HeapProfiler.addInspectedHeapObject"

Return Type

Promise<void>
Session.prototype.post(
method: "HeapProfiler.getHeapObjectId",
): Promise<HeapProfiler.GetHeapObjectIdReturnType>
Deprecated

Parameters

method: "HeapProfiler.getHeapObjectId"

Return Type

Session.prototype.post(
method: "HeapProfiler.startSampling",
): Promise<void>
Deprecated

Parameters

method: "HeapProfiler.startSampling"

Return Type

Promise<void>
Session.prototype.post(method: "HeapProfiler.stopSampling"): Promise<HeapProfiler.StopSamplingReturnType>
Deprecated

Parameters

method: "HeapProfiler.stopSampling"

Return Type

Session.prototype.post(method: "HeapProfiler.getSamplingProfile"): Promise<HeapProfiler.GetSamplingProfileReturnType>
Deprecated

Parameters

method: "HeapProfiler.getSamplingProfile"

Return Type

Session.prototype.post(method: "NodeTracing.getCategories"): Promise<NodeTracing.GetCategoriesReturnType>
Deprecated

Gets supported tracing categories.

Parameters

method: "NodeTracing.getCategories"

Return Type

Session.prototype.post(
method: "NodeTracing.start",
): Promise<void>
Deprecated

Start trace events collection.

Parameters

method: "NodeTracing.start"

Return Type

Promise<void>
Session.prototype.post(method: "NodeTracing.stop"): Promise<void>
Deprecated

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

Parameters

method: "NodeTracing.stop"

Return Type

Promise<void>
Session.prototype.post(
method: "NodeWorker.sendMessageToWorker",
): Promise<void>
Deprecated

Sends protocol message over session with given id.

Parameters

method: "NodeWorker.sendMessageToWorker"

Return Type

Promise<void>
Session.prototype.post(
method: "NodeWorker.enable",
): Promise<void>
Deprecated

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

Parameters

method: "NodeWorker.enable"

Return Type

Promise<void>
Session.prototype.post(method: "NodeWorker.disable"): Promise<void>
Deprecated

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

Parameters

method: "NodeWorker.disable"

Return Type

Promise<void>
Session.prototype.post(
method: "NodeWorker.detach",
): Promise<void>
Deprecated

Detached from the worker with given sessionId.

Parameters

method: "NodeWorker.detach"

Return Type

Promise<void>
Session.prototype.post(method: "Network.disable"): Promise<void>
Deprecated

Disables network tracking, prevents network events from being sent to the client.

Parameters

method: "Network.disable"

Return Type

Promise<void>
Session.prototype.post(method: "Network.enable"): Promise<void>
Deprecated

Enables network tracking, network events will now be delivered to the client.

Parameters

method: "Network.enable"

Return Type

Promise<void>
Session.prototype.post(method: "NodeRuntime.enable"): Promise<void>
Deprecated

Enable the NodeRuntime events except by NodeRuntime.waitingForDisconnect.

Parameters

method: "NodeRuntime.enable"

Return Type

Promise<void>
Session.prototype.post(method: "NodeRuntime.disable"): Promise<void>
Deprecated

Disable NodeRuntime events

Parameters

method: "NodeRuntime.disable"

Return Type

Promise<void>
Session.prototype.post(
method: "NodeRuntime.notifyWhenWaitingForDisconnect",
): Promise<void>
Deprecated

Enable the NodeRuntime.waitingForDisconnect.

Parameters

method: "NodeRuntime.notifyWhenWaitingForDisconnect"

Return Type

Promise<void>
Back to top