MCPcopy Index your code
hub / github.com/nodejs/node / constructor

Method constructor

test/common/inspector-helper.js:123–152  ·  view source on GitHub ↗
(socket, instance)

Source from the content-addressed store, hash-verified

121
122class InspectorSession {
123 constructor(socket, instance) {
124 this._instance = instance;
125 this._socket = socket;
126 this._nextId = 1;
127 this._commandResponsePromises = new Map();
128 this._unprocessedNotifications = [];
129 this._notificationCallback = null;
130 this._scriptsIdsByUrl = new Map();
131 this._pausedDetails = null;
132
133 let buffer = Buffer.alloc(0);
134 socket.on('data', (data) => {
135 buffer = Buffer.concat([buffer, data]);
136 do {
137 const { length, message, closed } = parseWSFrame(buffer);
138 if (!length)
139 break;
140
141 if (closed) {
142 socket.write(Buffer.from([0x88, 0x00])); // WS close frame
143 }
144 buffer = buffer.slice(length);
145 if (message)
146 this._onMessage(message);
147 } while (true);
148 });
149 this._terminationPromise = new Promise((resolve) => {
150 socket.once('close', resolve);
151 });
152 }
153
154
155 waitForServerDisconnect() {

Callers

nothing calls this directly

Calls 9

_onMessageMethod · 0.95
parseWSFrameFunction · 0.85
allocMethod · 0.80
concatMethod · 0.80
sliceMethod · 0.65
onMethod · 0.45
writeMethod · 0.45
fromMethod · 0.45
onceMethod · 0.45

Tested by

no test coverage detected