MCPcopy
hub / github.com/coder/mux / closeClientWebSocket

Function closeClientWebSocket

src/node/services/browser/BrowserBridgeServer.test.ts:211–220  ·  view source on GitHub ↗
(ws: WebSocket)

Source from the content-addressed store, hash-verified

209}
210
211async function closeClientWebSocket(ws: WebSocket): Promise<void> {
212 if (ws.readyState === WebSocket.CLOSED) {
213 return;
214 }
215
216 await new Promise<void>((resolve) => {
217 ws.once("close", () => resolve());
218 ws.close();
219 });
220}
221
222async function waitForMessage(ws: WebSocket): Promise<string> {
223 return await new Promise<string>((resolve, reject) => {

Callers 1

Calls 2

closeMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected