MCPcopy
hub / github.com/microsoft/playwright / close

Method close

packages/utils/wsServer.ts:160–183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

158 }
159
160 async close() {
161 const server = this._wsServer;
162 if (!server)
163 return;
164 debugLogger.log('server', 'closing websocket server');
165 const waitForClose = new Promise(f => server.close(f));
166 // First disconnect all remaining clients.
167 await Promise.all(Array.from(server.clients).map(async ws => {
168 const connection = (ws as any)[kConnectionSymbol] as WSConnection | undefined;
169 if (connection)
170 await connection.close();
171 try {
172 ws.terminate();
173 } catch (e) {
174 }
175 }));
176 await waitForClose;
177 debugLogger.log('server', 'closing http server');
178 if (this.server)
179 await new Promise(f => this.server!.close(f));
180 this._wsServer = undefined;
181 this.server = undefined;
182 debugLogger.log('server', 'closed server');
183 }
184}

Callers

nothing calls this directly

Calls 4

logMethod · 0.65
closeMethod · 0.65
allMethod · 0.65
fromMethod · 0.45

Tested by

no test coverage detected