{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.0.json","id":"inspector","path":"/inspector","type":"module","module":"inspector","title":"Inspector","introducedIn":"v8.0.0","sourceLink":{"path":"lib/inspector.js","url":"https://github.com/nodejs/node/blob/HEAD/lib/inspector.js"},"stability":{"index":"2","description":"Stable"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `node:inspector` module provides an API for interacting with the V8\ninspector.\n\nIt can be accessed using:\n\n```mjs\nimport * as inspector from 'node:inspector/promises';\n```\n\n```cjs\nconst inspector = require('node:inspector/promises');\n```\n\nor\n\n```mjs\nimport * as inspector from 'node:inspector';\n```\n\n```cjs\nconst inspector = require('node:inspector');\n```","summary":"The `node:inspector` module provides an API for interacting with the V8 inspector.","examples":[{"language":"mjs","displayName":null,"code":"import * as inspector from 'node:inspector/promises';"},{"language":"cjs","displayName":null,"code":"const inspector = require('node:inspector/promises');"},{"language":"mjs","displayName":null,"code":"import * as inspector from 'node:inspector';"},{"language":"cjs","displayName":null,"code":"const inspector = require('node:inspector');"}],"children":[{"kind":"section","id":"promises-api","name":"Promises API","title":"Promises API","scope":"module","overloadOf":null,"stability":{"index":"1","description":"Experimental"},"added":["v19.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"class","id":"class-inspectorsession","name":"Session","title":"Class: `inspector.Session`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":{"text":"EventEmitter","links":[{"name":"EventEmitter","href":"events.html#class-eventemitter","start":0,"end":12}]},"description":"The `inspector.Session` is used for dispatching messages to the V8 inspector\nback-end and receiving message responses and notifications.","summary":"The `inspector.Session` is used for dispatching messages to the V8 inspector back-end and receiving message responses and notifications.","examples":[],"children":[{"kind":"constructor","id":"new-inspectorsession","name":"Session","title":"`new inspector.Session()`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Create a new instance of the `inspector.Session` class. The inspector session\nneeds to be connected through [`session.connect()`](#sessionconnect) before the messages\ncan be dispatched to the inspector backend.\n\nWhen using `Session`, the object outputted by the console API will not be\nreleased, unless we performed manually `Runtime.DiscardConsoleEntries`\ncommand.","summary":"Create a new instance of the `inspector.Session` class. The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend.","examples":[],"children":[]},{"kind":"event","id":"event-inspectornotification","name":"inspectorNotification","title":"Event: `'inspectorNotification'`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"The notification message object","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when any notification from the V8 Inspector is received.\n\n```js\nsession.on('inspectorNotification', (message) => console.log(message.method));\n// Debugger.paused\n// Debugger.resumed\n```\n\n> **Caveat** Breakpoints with same-thread session is not recommended, see\n> [support of breakpoints](#support-of-breakpoints).\n\nIt is also possible to subscribe only to notifications with specific method:","summary":"Emitted when any notification from the V8 Inspector is received.","examples":[{"language":"js","displayName":null,"code":"session.on('inspectorNotification', (message) => console.log(message.method));\n// Debugger.paused\n// Debugger.resumed"}],"children":[]},{"kind":"event","id":"event-inspector-protocol-method","name":"<inspector-protocol-method>","title":"Event: `<inspector-protocol-method>`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"The notification message object","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when an inspector notification is received that has its method field set\nto the `<inspector-protocol-method>` value.\n\nThe following snippet installs a listener on the [`'Debugger.paused'`](https://chromedevtools.github.io/devtools-protocol/v8/Debugger#event-paused)\nevent, and prints the reason for program suspension whenever program\nexecution is suspended (through breakpoints, for example):\n\n```js\nsession.on('Debugger.paused', ({ params }) => {\n  console.log(params.hitBreakpoints);\n});\n// [ '/the/file/that/has/the/breakpoint.js:11:0' ]\n```\n\n> **Caveat** Breakpoints with same-thread session is not recommended, see\n> [support of breakpoints](#support-of-breakpoints).","summary":"Emitted when an inspector notification is received that has its method field set to the `<inspector-protocol-method>` value.","examples":[{"language":"js","displayName":null,"code":"session.on('Debugger.paused', ({ params }) => {\n  console.log(params.hitBreakpoints);\n});\n// [ '/the/file/that/has/the/breakpoint.js:11:0' ]"}],"children":[]},{"kind":"method","id":"sessionconnect","name":"connect","title":"`session.connect()`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Connects a session to the inspector back-end.","summary":"Connects a session to the inspector back-end.","examples":[],"children":[]},{"kind":"method","id":"sessionconnecttomainthread","name":"connectToMainThread","title":"`session.connectToMainThread()`","scope":"module","overloadOf":null,"stability":null,"added":["v12.11.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Connects a session to the main thread inspector back-end. An exception will\nbe thrown if this API was not called on a Worker thread.","summary":"Connects a session to the main thread inspector back-end. An exception will be thrown if this API was not called on a Worker thread.","examples":[],"children":[]},{"kind":"method","id":"sessiondisconnect","name":"disconnect","title":"`session.disconnect()`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Immediately close the session. All pending message callbacks will be called\nwith an error. [`session.connect()`](#sessionconnect) will need to be called to be able to send\nmessages again. Reconnected session will lose all inspector state, such as\nenabled agents or configured breakpoints.","summary":"Immediately close the session. All pending message callbacks will be called with an error. `session.connect()` will need to be called to be able to send messages again. Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints.","examples":[],"children":[]},{"kind":"method","id":"sessionpostmethod-params","name":"post","title":"`session.post(method[, params])`","scope":"module","overloadOf":null,"stability":null,"added":["v19.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"method","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":""}},"description":"Posts a message to the inspector back-end.\n\n```mjs\nimport { Session } from 'node:inspector/promises';\ntry {\n  const session = new Session();\n  session.connect();\n  const result = await session.post('Runtime.evaluate', { expression: '2 + 2' });\n  console.log(result);\n} catch (error) {\n  console.error(error);\n}\n// Output: { result: { type: 'number', value: 4, description: '4' } }\n```\n\nThe latest version of the V8 inspector protocol is published on the\n[Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/).\n\nNode.js inspector supports all the Chrome DevTools Protocol domains declared\nby V8. Chrome DevTools Protocol domain provides an interface for interacting\nwith one of the runtime agents used to inspect the application state and listen\nto the run-time events.","summary":"Posts a message to the inspector back-end.","examples":[{"language":"mjs","displayName":null,"code":"import { Session } from 'node:inspector/promises';\ntry {\n  const session = new Session();\n  session.connect();\n  const result = await session.post('Runtime.evaluate', { expression: '2 + 2' });\n  console.log(result);\n} catch (error) {\n  console.error(error);\n}\n// Output: { result: { type: 'number', value: 4, description: '4' } }"}],"children":[]},{"kind":"section","id":"example-usage","name":"Example usage","title":"Example usage","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Apart from the debugger, various V8 Profilers are available through the DevTools\nprotocol.","summary":"Apart from the debugger, various V8 Profilers are available through the DevTools protocol.","examples":[],"children":[{"kind":"section","id":"cpu-profiler","name":"CPU profiler","title":"CPU profiler","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Here's an example showing how to use the [CPU Profiler](https://chromedevtools.github.io/devtools-protocol/v8/Profiler):\n\n```mjs\nimport { Session } from 'node:inspector/promises';\nimport fs from 'node:fs';\nconst session = new Session();\nsession.connect();\n\nawait session.post('Profiler.enable');\nawait session.post('Profiler.start');\n// Invoke business logic under measurement here...\n\n// some time later...\nconst { profile } = await session.post('Profiler.stop');\n\n// Write profile to disk, upload, etc.\nfs.writeFileSync('./profile.cpuprofile', JSON.stringify(profile));\n```","summary":"Here's an example showing how to use the CPU Profiler:","examples":[{"language":"mjs","displayName":null,"code":"import { Session } from 'node:inspector/promises';\nimport fs from 'node:fs';\nconst session = new Session();\nsession.connect();\n\nawait session.post('Profiler.enable');\nawait session.post('Profiler.start');\n// Invoke business logic under measurement here...\n\n// some time later...\nconst { profile } = await session.post('Profiler.stop');\n\n// Write profile to disk, upload, etc.\nfs.writeFileSync('./profile.cpuprofile', JSON.stringify(profile));"}],"children":[]},{"kind":"section","id":"heap-profiler","name":"Heap profiler","title":"Heap profiler","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Here's an example showing how to use the [Heap Profiler](https://chromedevtools.github.io/devtools-protocol/v8/HeapProfiler):\n\n```mjs\nimport { Session } from 'node:inspector/promises';\nimport fs from 'node:fs';\nconst session = new Session();\n\nconst fd = fs.openSync('profile.heapsnapshot', 'w');\n\nsession.connect();\n\nsession.on('HeapProfiler.addHeapSnapshotChunk', (m) => {\n  fs.writeSync(fd, m.params.chunk);\n});\n\nconst result = await session.post('HeapProfiler.takeHeapSnapshot', null);\nconsole.log('HeapProfiler.takeHeapSnapshot done:', result);\nsession.disconnect();\nfs.closeSync(fd);\n```","summary":"Here's an example showing how to use the Heap Profiler:","examples":[{"language":"mjs","displayName":null,"code":"import { Session } from 'node:inspector/promises';\nimport fs from 'node:fs';\nconst session = new Session();\n\nconst fd = fs.openSync('profile.heapsnapshot', 'w');\n\nsession.connect();\n\nsession.on('HeapProfiler.addHeapSnapshotChunk', (m) => {\n  fs.writeSync(fd, m.params.chunk);\n});\n\nconst result = await session.post('HeapProfiler.takeHeapSnapshot', null);\nconsole.log('HeapProfiler.takeHeapSnapshot done:', result);\nsession.disconnect();\nfs.closeSync(fd);"}],"children":[]}]}]}]},{"kind":"section","id":"callback-api","name":"Callback API","title":"Callback API","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"class","id":"class-inspectorsession-1","name":"Session","title":"Class: `inspector.Session`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":{"text":"EventEmitter","links":[{"name":"EventEmitter","href":"events.html#class-eventemitter","start":0,"end":12}]},"description":"The `inspector.Session` is used for dispatching messages to the V8 inspector\nback-end and receiving message responses and notifications.","summary":"The `inspector.Session` is used for dispatching messages to the V8 inspector back-end and receiving message responses and notifications.","examples":[],"children":[{"kind":"constructor","id":"new-inspectorsession-1","name":"Session","title":"`new inspector.Session()`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Create a new instance of the `inspector.Session` class. The inspector session\nneeds to be connected through [`session.connect()`](#sessionconnect) before the messages\ncan be dispatched to the inspector backend.\n\nWhen using `Session`, the object outputted by the console API will not be\nreleased, unless we performed manually `Runtime.DiscardConsoleEntries`\ncommand.","summary":"Create a new instance of the `inspector.Session` class. The inspector session needs to be connected through `session.connect()` before the messages can be dispatched to the inspector backend.","examples":[],"children":[]},{"kind":"event","id":"event-inspectornotification-1","name":"inspectorNotification","title":"Event: `'inspectorNotification'`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[{"name":"","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"The notification message object","default":null,"optional":false,"rest":false,"properties":[]}],"description":"Emitted when any notification from the V8 Inspector is received.\n\n```js\nsession.on('inspectorNotification', (message) => console.log(message.method));\n// Debugger.paused\n// Debugger.resumed\n```\n\n> **Caveat** Breakpoints with same-thread session is not recommended, see\n> [support of breakpoints](#support-of-breakpoints).\n\nIt is also possible to subscribe only to notifications with specific method:","summary":"Emitted when any notification from the V8 Inspector is received.","examples":[{"language":"js","displayName":null,"code":"session.on('inspectorNotification', (message) => console.log(message.method));\n// Debugger.paused\n// Debugger.resumed"}],"children":[]},{"kind":"section","id":"event-inspector-protocol-method-1","name":"Event: <inspector-protocol-method>;","title":"Event: `<inspector-protocol-method>`;","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"* Type: {Object} The notification message object\n\nEmitted when an inspector notification is received that has its method field set\nto the `<inspector-protocol-method>` value.\n\nThe following snippet installs a listener on the [`'Debugger.paused'`](https://chromedevtools.github.io/devtools-protocol/v8/Debugger#event-paused)\nevent, and prints the reason for program suspension whenever program\nexecution is suspended (through breakpoints, for example):\n\n```js\nsession.on('Debugger.paused', ({ params }) => {\n  console.log(params.hitBreakpoints);\n});\n// [ '/the/file/that/has/the/breakpoint.js:11:0' ]\n```\n\n> **Caveat** Breakpoints with same-thread session is not recommended, see\n> [support of breakpoints](#support-of-breakpoints).","summary":"Emitted when an inspector notification is received that has its method field set to the `<inspector-protocol-method>` value.","examples":[{"language":"js","displayName":null,"code":"session.on('Debugger.paused', ({ params }) => {\n  console.log(params.hitBreakpoints);\n});\n// [ '/the/file/that/has/the/breakpoint.js:11:0' ]"}],"children":[]},{"kind":"method","id":"sessionconnect-1","name":"connect","title":"`session.connect()`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Connects a session to the inspector back-end.","summary":"Connects a session to the inspector back-end.","examples":[],"children":[]},{"kind":"method","id":"sessionconnecttomainthread-1","name":"connectToMainThread","title":"`session.connectToMainThread()`","scope":"module","overloadOf":null,"stability":null,"added":["v12.11.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Connects a session to the main thread inspector back-end. An exception will\nbe thrown if this API was not called on a Worker thread.","summary":"Connects a session to the main thread inspector back-end. An exception will be thrown if this API was not called on a Worker thread.","examples":[],"children":[]},{"kind":"method","id":"sessiondisconnect-1","name":"disconnect","title":"`session.disconnect()`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Immediately close the session. All pending message callbacks will be called\nwith an error. [`session.connect()`](#sessionconnect) will need to be called to be able to send\nmessages again. Reconnected session will lose all inspector state, such as\nenabled agents or configured breakpoints.","summary":"Immediately close the session. All pending message callbacks will be called with an error. `session.connect()` will need to be called to be able to send messages again. Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints.","examples":[],"children":[]},{"kind":"method","id":"sessionpostmethod-params-callback","name":"post","title":"`session.post(method[, params][, callback])`","scope":"module","overloadOf":null,"stability":null,"added":["v8.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"method","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]},{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Posts a message to the inspector back-end. `callback` will be notified when\na response is received. `callback` is a function that accepts two optional\narguments: error and message-specific result.\n\n```js\nsession.post('Runtime.evaluate', { expression: '2 + 2' },\n             (error, { result }) => console.log(result));\n// Output: { type: 'number', value: 4, description: '4' }\n```\n\nThe latest version of the V8 inspector protocol is published on the\n[Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/).\n\nNode.js inspector supports all the Chrome DevTools Protocol domains declared\nby V8. Chrome DevTools Protocol domain provides an interface for interacting\nwith one of the runtime agents used to inspect the application state and listen\nto the run-time events.\n\nYou can not set `reportProgress` to `true` when sending a\n`HeapProfiler.takeHeapSnapshot` or `HeapProfiler.stopTrackingHeapObjects`\ncommand to V8.","summary":"Posts a message to the inspector back-end. `callback` will be notified when a response is received. `callback` is a function that accepts two optional arguments: error and message-specific result.","examples":[{"language":"js","displayName":null,"code":"session.post('Runtime.evaluate', { expression: '2 + 2' },\n             (error, { result }) => console.log(result));\n// Output: { type: 'number', value: 4, description: '4' }"}],"children":[]},{"kind":"section","id":"example-usage-1","name":"Example usage","title":"Example usage","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Apart from the debugger, various V8 Profilers are available through the DevTools\nprotocol.","summary":"Apart from the debugger, various V8 Profilers are available through the DevTools protocol.","examples":[],"children":[{"kind":"section","id":"cpu-profiler-1","name":"CPU profiler","title":"CPU profiler","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Here's an example showing how to use the [CPU Profiler](https://chromedevtools.github.io/devtools-protocol/v8/Profiler):\n\n```js\nconst inspector = require('node:inspector');\nconst fs = require('node:fs');\nconst session = new inspector.Session();\nsession.connect();\n\nsession.post('Profiler.enable', () => {\n  session.post('Profiler.start', () => {\n    // Invoke business logic under measurement here...\n\n    // some time later...\n    session.post('Profiler.stop', (err, { profile }) => {\n      // Write profile to disk, upload, etc.\n      if (!err) {\n        fs.writeFileSync('./profile.cpuprofile', JSON.stringify(profile));\n      }\n    });\n  });\n});\n```","summary":"Here's an example showing how to use the CPU Profiler:","examples":[{"language":"js","displayName":null,"code":"const inspector = require('node:inspector');\nconst fs = require('node:fs');\nconst session = new inspector.Session();\nsession.connect();\n\nsession.post('Profiler.enable', () => {\n  session.post('Profiler.start', () => {\n    // Invoke business logic under measurement here...\n\n    // some time later...\n    session.post('Profiler.stop', (err, { profile }) => {\n      // Write profile to disk, upload, etc.\n      if (!err) {\n        fs.writeFileSync('./profile.cpuprofile', JSON.stringify(profile));\n      }\n    });\n  });\n});"}],"children":[]},{"kind":"section","id":"heap-profiler-1","name":"Heap profiler","title":"Heap profiler","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Here's an example showing how to use the [Heap Profiler](https://chromedevtools.github.io/devtools-protocol/v8/HeapProfiler):\n\n```js\nconst inspector = require('node:inspector');\nconst fs = require('node:fs');\nconst session = new inspector.Session();\n\nconst fd = fs.openSync('profile.heapsnapshot', 'w');\n\nsession.connect();\n\nsession.on('HeapProfiler.addHeapSnapshotChunk', (m) => {\n  fs.writeSync(fd, m.params.chunk);\n});\n\nsession.post('HeapProfiler.takeHeapSnapshot', null, (err, r) => {\n  console.log('HeapProfiler.takeHeapSnapshot done:', err, r);\n  session.disconnect();\n  fs.closeSync(fd);\n});\n```","summary":"Here's an example showing how to use the Heap Profiler:","examples":[{"language":"js","displayName":null,"code":"const inspector = require('node:inspector');\nconst fs = require('node:fs');\nconst session = new inspector.Session();\n\nconst fd = fs.openSync('profile.heapsnapshot', 'w');\n\nsession.connect();\n\nsession.on('HeapProfiler.addHeapSnapshotChunk', (m) => {\n  fs.writeSync(fd, m.params.chunk);\n});\n\nsession.post('HeapProfiler.takeHeapSnapshot', null, (err, r) => {\n  console.log('HeapProfiler.takeHeapSnapshot done:', err, r);\n  session.disconnect();\n  fs.closeSync(fd);\n});"}],"children":[]}]}]}]},{"kind":"section","id":"common-objects","name":"Common Objects","title":"Common Objects","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"method","id":"inspectorclose","name":"close","title":"`inspector.close()`","scope":"module","overloadOf":null,"stability":null,"added":["v9.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.10.0"],"prUrl":"https://github.com/nodejs/node/pull/44489","commit":null,"description":"The API is exposed in the worker threads."}],"signature":{"parameters":[],"returns":null},"description":"Deactivates the inspector. If there are active connections, they are forcibly\nterminated. Blocks until the inspector server has fully stopped.","summary":"Deactivates the inspector. If there are active connections, they are forcibly terminated. Blocks until the inspector server has fully stopped.","examples":[],"children":[]},{"kind":"property","id":"inspectorconsole","name":"console","title":"`inspector.console`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"An object to send messages to the remote inspector console.\n\n```js\nrequire('node:inspector').console.log('a message');\n```\n\nThe inspector console does not have API parity with Node.js\nconsole.","summary":"The inspector console does not have API parity with Node.js console.","examples":[{"language":"js","displayName":null,"code":"require('node:inspector').console.log('a message');"}],"children":[]},{"kind":"method","id":"inspectoropenport-host-wait","name":"open","title":"`inspector.open([port[, host[, wait]]])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v20.6.0"],"prUrl":"https://github.com/nodejs/node/pull/48765","commit":null,"description":"inspector.open() now returns a `Disposable` object."}],"signature":{"parameters":[{"name":"port","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Port to listen on for inspector connections. Optional.","default":"what was specified on the CLI","optional":true,"rest":false,"properties":[]},{"name":"host","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Host to listen on for inspector connections. Optional.","default":"what was specified on the CLI","optional":true,"rest":false,"properties":[]},{"name":"wait","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Block until a client has connected. Optional.","default":"false","optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Disposable","links":[{"name":"Disposable","href":"https://tc39.es/proposal-explicit-resource-management/#sec-disposable-interface","start":0,"end":10}]},"description":"A Disposable that calls [`inspector.close()`](#inspectorclose)."}},"description":"Activate inspector on host and port. Equivalent to\n`node --inspect=[[host:]port]`, but can be done programmatically after node has\nstarted.\n\nIf wait is `true`, will block until a client has connected to the inspect port\nand flow control has been passed to the debugger client.\n\nSee the [security warning](cli.html#warning-binding-inspector-to-a-public-ipport-combination-is-insecure) regarding the `host`\nparameter usage.","summary":"Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has started.","examples":[],"children":[]},{"kind":"method","id":"inspectorurl","name":"url","title":"`inspector.url()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"string | undefined","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"undefined","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type","start":9,"end":18}]},"description":""}},"description":"Return the URL of the active inspector, or `undefined` if there is none.\n\n```console\n$ node --inspect -p 'inspector.url()'\nDebugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34\nFor help, see: https://nodejs.org/learn/getting-started/debugging\nws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34\n\n$ node --inspect=localhost:3000 -p 'inspector.url()'\nDebugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a\nFor help, see: https://nodejs.org/learn/getting-started/debugging\nws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a\n\n$ node -p 'inspector.url()'\nundefined\n```","summary":"Return the URL of the active inspector, or `undefined` if there is none.","examples":[{"language":"console","displayName":null,"code":"$ node --inspect -p 'inspector.url()'\nDebugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34\nFor help, see: https://nodejs.org/learn/getting-started/debugging\nws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34\n\n$ node --inspect=localhost:3000 -p 'inspector.url()'\nDebugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a\nFor help, see: https://nodejs.org/learn/getting-started/debugging\nws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a\n\n$ node -p 'inspector.url()'\nundefined"}],"children":[]},{"kind":"method","id":"inspectorwaitfordebugger","name":"waitForDebugger","title":"`inspector.waitForDebugger()`","scope":"module","overloadOf":null,"stability":null,"added":["v12.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Blocks until a client (existing or connected later) has sent\n`Runtime.runIfWaitingForDebugger` command.\n\nAn exception will be thrown if there is no active inspector.","summary":"Blocks until a client (existing or connected later) has sent `Runtime.runIfWaitingForDebugger` command.","examples":[],"children":[]}]},{"kind":"section","id":"integration-with-devtools","name":"Integration with DevTools","title":"Integration with DevTools","scope":"module","overloadOf":null,"stability":{"index":"1.1","description":"Active development"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `node:inspector` module provides an API for integrating with devtools that support Chrome DevTools Protocol.\nDevTools frontends connected to a running Node.js instance can capture protocol events emitted from the instance\nand display them accordingly to facilitate debugging.\nThe following methods broadcast a protocol event to all connected frontends.\nThe `params` passed to the methods can be optional, depending on the protocol.\n\n```js\n// The `Network.requestWillBeSent` event will be fired.\ninspector.Network.requestWillBeSent({\n  requestId: 'request-id-1',\n  timestamp: Date.now() / 1000,\n  wallTime: Date.now(),\n  request: {\n    url: 'https://nodejs.org/en',\n    method: 'GET',\n  },\n});\n```","summary":"The `node:inspector` module provides an API for integrating with devtools that support Chrome DevTools Protocol. DevTools frontends connected to a running Node.js instance can capture protocol events emitted from the instance and display them accordingly to facilitate debugging. The following methods broadcast a protocol event to all connected frontends. The `params` passed to the methods can be optional, depending on the protocol.","examples":[{"language":"js","displayName":null,"code":"// The `Network.requestWillBeSent` event will be fired.\ninspector.Network.requestWillBeSent({\n  requestId: 'request-id-1',\n  timestamp: Date.now() / 1000,\n  wallTime: Date.now(),\n  request: {\n    url: 'https://nodejs.org/en',\n    method: 'GET',\n  },\n});"}],"children":[{"kind":"method","id":"inspectornetworkdatareceivedparams","name":"dataReceived","title":"`inspector.Network.dataReceived([params])`","scope":"module","overloadOf":null,"stability":null,"added":["v24.2.0","v22.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"This feature is only available with the `--experimental-network-inspection` flag enabled.\n\nBroadcasts the `Network.dataReceived` event to connected frontends, or buffers the data if\n`Network.streamResourceContent` command was not invoked for the given request yet.\n\nAlso enables `Network.getResponseBody` command to retrieve the response data.","summary":"This feature is only available with the `--experimental-network-inspection` flag enabled.","examples":[],"children":[]},{"kind":"method","id":"inspectornetworkdatasentparams","name":"dataSent","title":"`inspector.Network.dataSent([params])`","scope":"module","overloadOf":null,"stability":null,"added":["v24.3.0","v22.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"This feature is only available with the `--experimental-network-inspection` flag enabled.\n\nEnables `Network.getRequestPostData` command to retrieve the request data.","summary":"This feature is only available with the `--experimental-network-inspection` flag enabled.","examples":[],"children":[]},{"kind":"method","id":"inspectornetworkrequestwillbesentparams","name":"requestWillBeSent","title":"`inspector.Network.requestWillBeSent([params])`","scope":"module","overloadOf":null,"stability":null,"added":["v22.6.0","v20.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"This feature is only available with the `--experimental-network-inspection` flag enabled.\n\nBroadcasts the `Network.requestWillBeSent` event to connected frontends. This event indicates that\nthe application is about to send an HTTP request.","summary":"This feature is only available with the `--experimental-network-inspection` flag enabled.","examples":[],"children":[]},{"kind":"method","id":"inspectornetworkresponsereceivedparams","name":"responseReceived","title":"`inspector.Network.responseReceived([params])`","scope":"module","overloadOf":null,"stability":null,"added":["v22.6.0","v20.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"This feature is only available with the `--experimental-network-inspection` flag enabled.\n\nBroadcasts the `Network.responseReceived` event to connected frontends. This event indicates that\nHTTP response is available.","summary":"This feature is only available with the `--experimental-network-inspection` flag enabled.","examples":[],"children":[]},{"kind":"method","id":"inspectornetworkloadingfinishedparams","name":"loadingFinished","title":"`inspector.Network.loadingFinished([params])`","scope":"module","overloadOf":null,"stability":null,"added":["v22.6.0","v20.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"This feature is only available with the `--experimental-network-inspection` flag enabled.\n\nBroadcasts the `Network.loadingFinished` event to connected frontends. This event indicates that\nHTTP request has finished loading.","summary":"This feature is only available with the `--experimental-network-inspection` flag enabled.","examples":[],"children":[]},{"kind":"method","id":"inspectornetworkloadingfailedparams","name":"loadingFailed","title":"`inspector.Network.loadingFailed([params])`","scope":"module","overloadOf":null,"stability":null,"added":["v22.7.0","v20.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"This feature is only available with the `--experimental-network-inspection` flag enabled.\n\nBroadcasts the `Network.loadingFailed` event to connected frontends. This event indicates that\nHTTP request has failed to load.","summary":"This feature is only available with the `--experimental-network-inspection` flag enabled.","examples":[],"children":[]},{"kind":"method","id":"inspectornetworkwebsocketcreatedparams","name":"webSocketCreated","title":"`inspector.Network.webSocketCreated([params])`","scope":"module","overloadOf":null,"stability":null,"added":["v24.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"This feature is only available with the `--experimental-network-inspection` flag enabled.\n\nBroadcasts the `Network.webSocketCreated` event to connected frontends. This event indicates that\na WebSocket connection has been initiated.","summary":"This feature is only available with the `--experimental-network-inspection` flag enabled.","examples":[],"children":[]},{"kind":"method","id":"inspectornetworkwebsockethandshakeresponsereceivedparams","name":"webSocketHandshakeResponseReceived","title":"`inspector.Network.webSocketHandshakeResponseReceived([params])`","scope":"module","overloadOf":null,"stability":null,"added":["v24.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"This feature is only available with the `--experimental-network-inspection` flag enabled.\n\nBroadcasts the `Network.webSocketHandshakeResponseReceived` event to connected frontends.\nThis event indicates that the WebSocket handshake response has been received.","summary":"This feature is only available with the `--experimental-network-inspection` flag enabled.","examples":[],"children":[]},{"kind":"method","id":"inspectornetworkwebsocketclosedparams","name":"webSocketClosed","title":"`inspector.Network.webSocketClosed([params])`","scope":"module","overloadOf":null,"stability":null,"added":["v24.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"params","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"This feature is only available with the `--experimental-network-inspection` flag enabled.\n\nBroadcasts the `Network.webSocketClosed` event to connected frontends.\nThis event indicates that a WebSocket connection has been closed.","summary":"This feature is only available with the `--experimental-network-inspection` flag enabled.","examples":[],"children":[]},{"kind":"property","id":"inspectornetworkresourcesput","name":"put","title":"`inspector.NetworkResources.put`","scope":"module","overloadOf":null,"stability":{"index":"1.1","description":"Active Development"},"added":["v24.5.0","v22.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":null,"default":null,"description":"This feature is only available with the `--experimental-inspector-network-resource` flag enabled.\n\nThe inspector.NetworkResources.put method is used to provide a response for a loadNetworkResource\nrequest issued via the Chrome DevTools Protocol (CDP).\nThis is typically triggered when a source map is specified by URL, and a DevTools frontend—such as\nChrome—requests the resource to retrieve the source map.\n\nThis method allows developers to predefine the resource content to be served in response to such CDP requests.\n\n```js\nconst inspector = require('node:inspector');\n// By preemptively calling put to register the resource, a source map can be resolved when\n// a loadNetworkResource request is made from the frontend.\nasync function setNetworkResources() {\n  const mapUrl = 'http://localhost:3000/dist/app.js.map';\n  const tsUrl = 'http://localhost:3000/src/app.ts';\n  const distAppJsMap = await fetch(mapUrl).then((res) => res.text());\n  const srcAppTs = await fetch(tsUrl).then((res) => res.text());\n  inspector.NetworkResources.put(mapUrl, distAppJsMap);\n  inspector.NetworkResources.put(tsUrl, srcAppTs);\n};\nsetNetworkResources().then(() => {\n  require('./dist/app');\n});\n```\n\nFor more details, see the official CDP documentation: [Network.loadNetworkResource](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-loadNetworkResource)","summary":"This feature is only available with the `--experimental-inspector-network-resource` flag enabled.","examples":[{"language":"js","displayName":null,"code":"const inspector = require('node:inspector');\n// By preemptively calling put to register the resource, a source map can be resolved when\n// a loadNetworkResource request is made from the frontend.\nasync function setNetworkResources() {\n  const mapUrl = 'http://localhost:3000/dist/app.js.map';\n  const tsUrl = 'http://localhost:3000/src/app.ts';\n  const distAppJsMap = await fetch(mapUrl).then((res) => res.text());\n  const srcAppTs = await fetch(tsUrl).then((res) => res.text());\n  inspector.NetworkResources.put(mapUrl, distAppJsMap);\n  inspector.NetworkResources.put(tsUrl, srcAppTs);\n};\nsetNetworkResources().then(() => {\n  require('./dist/app');\n});"}],"children":[]},{"kind":"property","id":"inspectordomstoragedomstorageitemadded","name":"domStorageItemAdded","title":"`inspector.DOMStorage.domStorageItemAdded`","scope":"module","overloadOf":null,"stability":null,"added":["v25.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"This feature is only available with the\n`--experimental-storage-inspection` flag enabled.\n\nBroadcasts the `DOMStorage.domStorageItemAdded` event to connected frontends.\nThis event indicates that a new item has been added to the storage.","summary":"This feature is only available with the `--experimental-storage-inspection` flag enabled.","examples":[],"children":[]},{"kind":"property","id":"inspectordomstoragedomstorageitemremoved","name":"domStorageItemRemoved","title":"`inspector.DOMStorage.domStorageItemRemoved`","scope":"module","overloadOf":null,"stability":null,"added":["v25.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"This feature is only available with the\n`--experimental-storage-inspection` flag enabled.\n\nBroadcasts the `DOMStorage.domStorageItemRemoved` event to connected frontends.\nThis event indicates that an item has been removed from the storage.","summary":"This feature is only available with the `--experimental-storage-inspection` flag enabled.","examples":[],"children":[]},{"kind":"property","id":"inspectordomstoragedomstorageitemupdated","name":"domStorageItemUpdated","title":"`inspector.DOMStorage.domStorageItemUpdated`","scope":"module","overloadOf":null,"stability":null,"added":["v25.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"This feature is only available with the\n`--experimental-storage-inspection` flag enabled.\n\nBroadcasts the `DOMStorage.domStorageItemUpdated` event to connected frontends.\nThis event indicates that a storage item has been updated.","summary":"This feature is only available with the `--experimental-storage-inspection` flag enabled.","examples":[],"children":[]},{"kind":"property","id":"inspectordomstoragedomstorageitemscleared","name":"domStorageItemsCleared","title":"`inspector.DOMStorage.domStorageItemsCleared`","scope":"module","overloadOf":null,"stability":null,"added":["v25.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"This feature is only available with the\n`--experimental-storage-inspection` flag enabled.\n\nBroadcasts the `DOMStorage.domStorageItemsCleared` event to connected\nfrontends. This event indicates that all items have been cleared from the\nstorage.","summary":"This feature is only available with the `--experimental-storage-inspection` flag enabled.","examples":[],"children":[]},{"kind":"property","id":"inspectordomstorageregisterstorage","name":"registerStorage","title":"`inspector.DOMStorage.registerStorage`","scope":"module","overloadOf":null,"stability":null,"added":["v25.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"This feature is only available with the\n`--experimental-storage-inspection` flag enabled.","summary":"This feature is only available with the `--experimental-storage-inspection` flag enabled.","examples":[],"children":[]}]},{"kind":"section","id":"support-of-breakpoints","name":"Support of breakpoints","title":"Support of breakpoints","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The Chrome DevTools Protocol [`Debugger` domain](https://chromedevtools.github.io/devtools-protocol/v8/Debugger) allows an\n`inspector.Session` to attach to a program and set breakpoints to step through\nthe codes.\n\nHowever, setting breakpoints with a same-thread `inspector.Session`, which is\nconnected by [`session.connect()`](#sessionconnect), should be avoided as the program being\nattached and paused is exactly the debugger itself. Instead, try connect to the\nmain thread by [`session.connectToMainThread()`](#sessionconnecttomainthread) and set breakpoints in a\nworker thread, or connect with a [Debugger](debugger.html) program over WebSocket\nconnection.","summary":"The Chrome DevTools Protocol `Debugger` domain allows an `inspector.Session` to attach to a program and set breakpoints to step through the codes.","examples":[],"children":[]}]}